test_location_is_set

This commit is contained in:
ed 2024-05-24 10:05:46 +02:00
parent 3467a5a8ff
commit 3443dea90c
1 changed files with 9 additions and 6 deletions

View File

@ -118,10 +118,13 @@ class TestAssertionRewrite:
s = textwrap.dedent( s = textwrap.dedent(
""" """
assert False, ( assert abs(
123
"Ouch" - 456) == round(
) 1000
/ 3,
ndigits=1
)
""" """
) )
@ -133,8 +136,8 @@ class TestAssertionRewrite:
assert isinstance(n, (ast.stmt, ast.expr)) assert isinstance(n, (ast.stmt, ast.expr))
assert n.lineno == 3 assert n.lineno == 3
assert n.col_offset == 0 assert n.col_offset == 0
assert n.end_lineno == 6 assert n.end_lineno == 9
assert n.end_col_offset == 3 assert n.end_col_offset == 5
def test_dont_rewrite(self) -> None: def test_dont_rewrite(self) -> None:
s = """'PYTEST_DONT_REWRITE'\nassert 14""" s = """'PYTEST_DONT_REWRITE'\nassert 14"""