Skip to content

Commit

Permalink
Merge branch 'dev/0.15.7' of github.com:Erotemic/xdoctest into dev/0.…
Browse files Browse the repository at this point in the history
…15.7
  • Loading branch information
Erotemic committed Aug 22, 2021
2 parents 5f2786b + 0e94adf commit ff5d92e
Showing 1 changed file with 65 additions and 56 deletions.
121 changes: 65 additions & 56 deletions testing/test_traceback.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,78 +7,87 @@


def test_fail_call_onefunc():
text = _run_case(utils.codeblock(
'''
def func(a):
"""
Example:
>>> a = 1
>>> func(a)
"""
a = []()
return a
'''))
assert '>>> func(a)' in text
assert 'rel: 2, abs: 5' in text
import warnings
with warnings.catch_warnings():
warnings.simplefilter("ignore")
text = _run_case(utils.codeblock(
'''
def func(a):
"""
Example:
>>> a = 1
>>> func(a)
"""
a = []()
return a
'''))
assert '>>> func(a)' in text
assert 'rel: 2, abs: 5' in text


def test_fail_call_twofunc():
"""
python ~/code/xdoctest/testing/test_traceback.py test_fail_call_twofunc
"""
text = _run_case(utils.codeblock(
'''
def func(a):
"""
Example:
>>> a = 1
>>> func(a)
"""
a = []()
return a
import warnings
with warnings.catch_warnings():
warnings.simplefilter("ignore")
text = _run_case(utils.codeblock(
'''
def func(a):
"""
Example:
>>> a = 1
>>> func(a)
"""
a = []()
return a
def func2(a):
"""
Example:
>>> pass
"""
pass
'''))
assert text
assert '>>> func(a)' in text
assert 'rel: 2, abs: 5,' in text
def func2(a):
"""
Example:
>>> pass
"""
pass
'''))
assert text
assert '>>> func(a)' in text
assert 'rel: 2, abs: 5,' in text


def test_fail_inside_twofunc():
"""
python ~/code/xdoctest/testing/test_traceback.py test_fail_inside_twofunc
"""
text = _run_case(utils.codeblock(
'''
def func(a):
"""
Example:
>>> print('not failed')
>>> # just a comment
>>> print(("foo"
... "bar"))
>>> a = []()
>>> func(a)
"""
return a
import warnings
with warnings.catch_warnings():
warnings.simplefilter("ignore")
text = _run_case(utils.codeblock(
'''
def func(a):
"""
Example:
>>> print('not failed')
>>> # just a comment
>>> print(("foo"
... "bar"))
>>> a = []()
>>> func(a)
"""
return a
def func2(a):
"""
Example:
>>> pass
"""
pass
'''))
assert text
assert '>>> a = []()' in text
assert 'rel: 5, abs: 8' in text
def func2(a):
"""
Example:
>>> pass
"""
pass
'''))
assert text
assert '>>> a = []()' in text
assert 'rel: 5, abs: 8' in text


def test_fail_inside_onefunc():
Expand Down

0 comments on commit ff5d92e

Please sign in to comment.