Skip to content

Commit

Permalink
Fix test_comments() in test_source
Browse files Browse the repository at this point in the history
Copied the test as fixed in pytest's repo.
  • Loading branch information
nicoddemus committed Dec 11, 2020
1 parent fef9a32 commit e94e670
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions testing/code/test_source.py
Expand Up @@ -510,11 +510,17 @@ def test_comments():
comment 4
"""
'''
for line in range(2,6):
assert str(getstatement(line, source)) == ' x = 1'
for line in range(6,10):
assert str(getstatement(line, source)) == ' assert False'
assert str(getstatement(10, source)) == '"""'
for line in range(2, 6):
assert str(getstatement(line, source)) == " x = 1"
if sys.version_info >= (3, 8) or hasattr(sys, "pypy_version_info"):
tqs_start = 8
else:
tqs_start = 10
assert str(getstatement(10, source)) == '"""'
for line in range(6, tqs_start):
assert str(getstatement(line, source)) == " assert False"
for line in range(tqs_start, 10):
assert str(getstatement(line, source)) == '"""\ncomment 4\n"""'

def test_comment_in_statement():
source = '''test(foo=1,
Expand Down

0 comments on commit e94e670

Please sign in to comment.