[issue28249] doctest.DocTestFinder reports incorrect line numbers with exclude_empty=False

2022-01-09 Thread Kumar Aditya


Change by Kumar Aditya :


--
nosy: +kumaraditya303
type:  -> behavior
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28249] doctest.DocTestFinder reports incorrect line numbers with exclude_empty=False

2022-01-09 Thread Nikita Sobolev


Change by Nikita Sobolev :


--
keywords: +patch
nosy: +sobolevn
nosy_count: 2.0 -> 3.0
pull_requests: +28704
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30498

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28249] doctest.DocTestFinder reports incorrect line numbers with exclude_empty=False

2019-12-10 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28249] doctest.DocTestFinder reports incorrect line numbers with exclude_empty=False

2016-09-22 Thread Clément

New submission from Clément:

Line numbers reported by the doctest module are wrong when a function does not 
include a docstring.  With the attached example file, running

python -c "import doctest, example; 
print(doctest.DocTestFinder(exclude_empty=False).find(example))"

produces

[,
 ,
 ,
 ]

whereas if one uncomments the docstrings of a and c the output is

[,
 ,
 ,
 ]

This bug is due to this line in doctest:

lineno = self._find_lineno(obj, source_lines)

The documentation of _find_lineno says this:

def _find_lineno(self, obj, source_lines):
"""
Return a line number of the given object's docstring.  Note:
this method assumes that the object has a docstring.
"""

This assumption is violated by the call listed above, because of the 
exclude_empty=False parameter to DocTestFinder().

I guess lineno should just be None for all methods that do not have a docstring?

--
components: Library (Lib)
files: example.py
messages: 277230
nosy: cpitclaudel
priority: normal
severity: normal
status: open
title: doctest.DocTestFinder reports incorrect line numbers with 
exclude_empty=False
versions: Python 2.7, Python 3.5
Added file: http://bugs.python.org/file44786/example.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com