(self)
| 800 | self.assertNotInBytecode(code, "SWAP") |
| 801 | |
| 802 | def test_static_swaps_match_sequence(self): |
| 803 | swaps = {"*_, b, c", "a, *_, c", "a, b, *_"} |
| 804 | forms = ["{}, {}, {}", "{}, {}, *{}", "{}, *{}, {}", "*{}, {}, {}"] |
| 805 | for a, b, c in product("_a", "_b", "_c"): |
| 806 | for form in forms: |
| 807 | pattern = form.format(a, b, c) |
| 808 | with self.subTest(pattern): |
| 809 | code = compile_pattern_with_fast_locals(pattern) |
| 810 | if pattern in swaps: |
| 811 | # If this fails... great! Remove this pattern from swaps |
| 812 | # to prevent regressing on any improvement: |
| 813 | self.assertInBytecode(code, "SWAP") |
| 814 | else: |
| 815 | self.assertNotInBytecode(code, "SWAP") |
| 816 | |
| 817 | |
| 818 | class TestBuglets(unittest.TestCase): |
nothing calls this directly
no test coverage detected