MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_column_offset_deduplication

Function test_column_offset_deduplication

Lib/test/test_compile.py:2399–2414  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2397
2398 @support.cpython_only
2399 def test_column_offset_deduplication(self):
2400 # GH-95150: Code with different column offsets shouldn't be merged!
2401 for source in [
2402 "lambda: a",
2403 "(a for b in c)",
2404 ]:
2405 with self.subTest(source):
2406 code = compile(f"{source}, {source}", "<test>", "eval")
2407 self.assertEqual(len(code.co_consts), 2)
2408 self.assertIsInstance(code.co_consts[0], types.CodeType)
2409 self.assertIsInstance(code.co_consts[1], types.CodeType)
2410 self.assertNotEqual(code.co_consts[0], code.co_consts[1])
2411 self.assertNotEqual(
2412 list(code.co_consts[0].co_positions()),
2413 list(code.co_consts[1].co_positions()),
2414 )
2415
2416 def test_load_super_attr(self):
2417 source = "class C:\n def __init__(self):\n super().__init__()"

Callers

nothing calls this directly

Calls 8

lenFunction · 0.85
listClass · 0.85
subTestMethod · 0.80
assertIsInstanceMethod · 0.80
assertNotEqualMethod · 0.80
co_positionsMethod · 0.80
compileFunction · 0.50
assertEqualMethod · 0.45

Tested by

no test coverage detected