(self, code)
| 2553 | N = 100 |
| 2554 | |
| 2555 | def check_stack_size(self, code): |
| 2556 | # To assert that the alleged stack size is not O(N), we |
| 2557 | # check that it is smaller than log(N). |
| 2558 | if isinstance(code, str): |
| 2559 | code = compile(code, "<foo>", "single") |
| 2560 | max_size = math.ceil(math.log(len(code.co_code))) |
| 2561 | self.assertLessEqual(code.co_stacksize, max_size) |
| 2562 | |
| 2563 | def test_and(self): |
| 2564 | self.check_stack_size("x and " * self.N + "x") |
nothing calls this directly
no test coverage detected