diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-12-15 10:35:48 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-15 10:35:48 (GMT) |
commit | 3325a6780c81f1ea51190370b5454879c4862a37 (patch) | |
tree | 3100f972b635137528b105c410ab88e6bff64521 /Lib/test/test_builtin.py | |
parent | 297fd876aad8ef443d8992618de22c46dbda258b (diff) | |
download | cpython-3325a6780c81f1ea51190370b5454879c4862a37.zip cpython-3325a6780c81f1ea51190370b5454879c4862a37.tar.gz cpython-3325a6780c81f1ea51190370b5454879c4862a37.tar.bz2 |
bpo-27169: The __debug__ constant is now optimized out at compile time. (#4880)
This fixes also bpo-22091.
Diffstat (limited to 'Lib/test/test_builtin.py')
-rw-r--r-- | Lib/test/test_builtin.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py index 9329318..8f91bc9 100644 --- a/Lib/test/test_builtin.py +++ b/Lib/test/test_builtin.py @@ -337,16 +337,16 @@ class BuiltinTest(unittest.TestCase): try: assert False except AssertionError: - return (True, f.__doc__, debug_enabled) + return (True, f.__doc__, debug_enabled, __debug__) else: - return (False, f.__doc__, debug_enabled) + return (False, f.__doc__, debug_enabled, __debug__) ''' def f(): """doc""" - values = [(-1, __debug__, f.__doc__, __debug__), - (0, True, 'doc', True), - (1, False, 'doc', False), - (2, False, None, False)] - for optval, assertval, docstring, debugval in values: + values = [(-1, __debug__, f.__doc__, __debug__, __debug__), + (0, True, 'doc', True, True), + (1, False, 'doc', False, False), + (2, False, None, False, False)] + for optval, *expected in values: # test both direct compilation and compilation via AST codeobjs = [] codeobjs.append(compile(codestr, "<test>", "exec", optimize=optval)) @@ -356,7 +356,7 @@ class BuiltinTest(unittest.TestCase): ns = {} exec(code, ns) rv = ns['f']() - self.assertEqual(rv, (assertval, docstring, debugval)) + self.assertEqual(rv, tuple(expected)) def test_delattr(self): sys.spam = 1 |