MCPcopy Index your code
hub / github.com/python/cpython / test_fix_missing_locations

Method test_fix_missing_locations

Lib/test/test_ast/test_ast.py:1725–1742  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1723 self.assertEqual(new.col_offset, 1)
1724
1725 def test_fix_missing_locations(self):
1726 src = ast.parse('write("spam")')
1727 src.body.append(ast.Expr(ast.Call(ast.Name('spam', ast.Load()),
1728 [ast.Constant('eggs')], [])))
1729 self.assertEqual(src, ast.fix_missing_locations(src))
1730 self.maxDiff = None
1731 self.assertEqual(ast.dump(src, include_attributes=True),
1732 "Module(body=[Expr(value=Call(func=Name(id='write', "
1733 "lineno=1, col_offset=0, end_lineno=1, end_col_offset=5), "
1734 "args=[Constant(value='spam', lineno=1, col_offset=6, end_lineno=1, "
1735 "end_col_offset=12)], lineno=1, col_offset=0, end_lineno=1, "
1736 "end_col_offset=13), lineno=1, col_offset=0, end_lineno=1, "
1737 "end_col_offset=13), Expr(value=Call(func=Name(id='spam', "
1738 "lineno=1, col_offset=0, end_lineno=1, end_col_offset=0), "
1739 "args=[Constant(value='eggs', lineno=1, col_offset=0, end_lineno=1, "
1740 "end_col_offset=0)], lineno=1, col_offset=0, end_lineno=1, "
1741 "end_col_offset=0), lineno=1, col_offset=0, end_lineno=1, end_col_offset=0)])"
1742 )
1743
1744 def test_increment_lineno(self):
1745 src = ast.parse('1 + 1', mode='eval')

Callers

nothing calls this directly

Calls 5

LoadMethod · 0.80
parseMethod · 0.45
appendMethod · 0.45
assertEqualMethod · 0.45
dumpMethod · 0.45

Tested by

no test coverage detected