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

Method test_pack_unpack

Lib/test/test_peepholer.py:146–157  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

144 self.check_lnotab(f)
145
146 def test_pack_unpack(self):
147 for line, elem in (
148 ('a, = a,', 'LOAD_CONST',),
149 ('a, b = a, b', 'SWAP',),
150 ('a, b, c = a, b, c', 'SWAP',),
151 ):
152 with self.subTest(line=line):
153 code = compile(line,'','single')
154 self.assertInBytecode(code, elem)
155 self.assertNotInBytecode(code, 'BUILD_TUPLE')
156 self.assertNotInBytecode(code, 'UNPACK_SEQUENCE')
157 self.check_lnotab(code)
158
159 def test_constant_folding_tuples_of_constants(self):
160 for line, elem in (

Callers

nothing calls this directly

Calls 5

check_lnotabMethod · 0.95
assertInBytecodeMethod · 0.80
assertNotInBytecodeMethod · 0.80
compileFunction · 0.50
subTestMethod · 0.45

Tested by

no test coverage detected