diff options
Diffstat (limited to 'Lib/test/test_opcodes.py')
-rw-r--r-- | Lib/test/test_opcodes.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/Lib/test/test_opcodes.py b/Lib/test/test_opcodes.py index 20de3867bf..b2a2286188 100644 --- a/Lib/test/test_opcodes.py +++ b/Lib/test/test_opcodes.py @@ -42,14 +42,13 @@ class OpcodeTest(unittest.TestCase): self.assertEqual(ns['__annotations__'], {'x': int, 1: 2}) def test_do_not_recreate_annotations(self): - annotations = {} # Don't rely on the existence of the '__annotations__' global. - with support.swap_item(globals(), '__annotations__', annotations): + with support.swap_item(globals(), '__annotations__', {}): + del globals()['__annotations__'] class C: del __annotations__ - x: int # Updates the '__annotations__' global. - self.assertIn('x', annotations) - self.assertIs(annotations['x'], int) + with self.assertRaises(NameError): + x: int def test_raise_class_exceptions(self): |