Skip to content

Commit d40d774

Browse files
committed
Add test case for DoctestItem.reportinfo()
1 parent dea671f commit d40d774

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

‎testing/test_doctest.py‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,22 @@ def fix_bad_unicode(text):
545545
result = testdir.runpytest(p, '--doctest-modules')
546546
result.stdout.fnmatch_lines(['* 1 passed *'])
547547

548+
def test_reportinfo(self, testdir):
549+
'''
550+
Test case to make sure that DoctestItem.reportinfo() returns lineno.
551+
'''
552+
p = testdir.makepyfile(test_reportinfo="""
553+
def foo(x):
554+
'''
555+
>>> foo('a')
556+
'b'
557+
'''
558+
return 'c'
559+
""")
560+
items, reprec = testdir.inline_genitems(p, '--doctest-modules')
561+
reportinfo = items[0].reportinfo()
562+
assert reportinfo[1] == 1
563+
548564

549565
class TestLiterals(object):
550566

0 commit comments

Comments
 (0)