MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_comments

Function test_comments

testing/code/test_source.py:431–454  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

429
430
431def test_comments() -> None:
432 source = '''def test():
433 "comment 1"
434 x = 1
435 # comment 2
436 # comment 3
437
438 assert False
439
440"""
441comment 4
442"""
443'''
444 for line in range(2, 6):
445 assert str(getstatement(line, source)) == " x = 1"
446 if sys.version_info >= (3, 8) or hasattr(sys, "pypy_version_info"):
447 tqs_start = 8
448 else:
449 tqs_start = 10
450 assert str(getstatement(10, source)) == '"""'
451 for line in range(6, tqs_start):
452 assert str(getstatement(line, source)) == " assert False"
453 for line in range(tqs_start, 10):
454 assert str(getstatement(line, source)) == '"""\ncomment 4\n"""'
455
456
457def test_comment_in_statement() -> None:

Callers

nothing calls this directly

Calls 1

getstatementFunction · 0.85

Tested by

no test coverage detected