Skip to content

Commit

Permalink
Add test case for DoctestItem.reportinfo()
Browse files Browse the repository at this point in the history
  • Loading branch information
hongquan committed Jul 24, 2017
1 parent dea671f commit d40d774
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions testing/test_doctest.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,22 @@ def fix_bad_unicode(text):
result = testdir.runpytest(p, '--doctest-modules')
result.stdout.fnmatch_lines(['* 1 passed *'])

def test_reportinfo(self, testdir):
'''
Test case to make sure that DoctestItem.reportinfo() returns lineno.
'''
p = testdir.makepyfile(test_reportinfo="""
def foo(x):
'''
>>> foo('a')
'b'
'''
return 'c'
""")
items, reprec = testdir.inline_genitems(p, '--doctest-modules')
reportinfo = items[0].reportinfo()
assert reportinfo[1] == 1


class TestLiterals(object):

Expand Down

0 comments on commit d40d774

Please sign in to comment.