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

Method test_static_swaps_match_class

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

Source from the content-addressed store, hash-verified

786 self.assertNotInBytecode(code, "SWAP")
787
788 def test_static_swaps_match_class(self):
789 forms = [
790 "C({}, {}, {})",
791 "C({}, {}, c={})",
792 "C({}, b={}, c={})",
793 "C(a={}, b={}, c={})"
794 ]
795 for a, b, c in product("_a", "_b", "_c"):
796 for form in forms:
797 pattern = form.format(a, b, c)
798 with self.subTest(pattern):
799 code = compile_pattern_with_fast_locals(pattern)
800 self.assertNotInBytecode(code, "SWAP")
801
802 def test_static_swaps_match_sequence(self):
803 swaps = {"*_, b, c", "a, *_, c", "a, b, *_"}

Callers

nothing calls this directly

Calls 4

assertNotInBytecodeMethod · 0.80
formatMethod · 0.45
subTestMethod · 0.45

Tested by

no test coverage detected