(self)
| 105 | self.check_lnotab(code) |
| 106 | |
| 107 | def test_global_as_constant(self): |
| 108 | # LOAD_GLOBAL None/True/False --> LOAD_CONST None/True/False |
| 109 | def f(): |
| 110 | x = None |
| 111 | x = None |
| 112 | return x |
| 113 | def g(): |
| 114 | x = True |
| 115 | return x |
| 116 | def h(): |
| 117 | x = False |
| 118 | return x |
| 119 | |
| 120 | for func, elem in ((f, None), (g, True), (h, False)): |
| 121 | with self.subTest(func=func): |
| 122 | self.assertNotInBytecode(func, 'LOAD_GLOBAL') |
| 123 | self.assertInBytecode(func, 'LOAD_CONST', elem) |
| 124 | self.check_lnotab(func) |
| 125 | |
| 126 | def f(): |
| 127 | 'Adding a docstring made this test fail in Py2.5.0' |
| 128 | return None |
| 129 | |
| 130 | self.assertNotInBytecode(f, 'LOAD_GLOBAL') |
| 131 | self.assertInBytecode(f, 'LOAD_CONST', None) |
| 132 | self.check_lnotab(f) |
| 133 | |
| 134 | def test_while_one(self): |
| 135 | # Skip over: LOAD_CONST trueconst POP_JUMP_IF_FALSE xx |
nothing calls this directly
no test coverage detected