From: Serhiy Storchaka Date: Tue, 24 Jul 2018 12:05:28 +0000 (+0300) Subject: bpo-34136: Make test_do_not_recreate_annotations more lenient. (GH-8437) X-Git-Tag: v3.8.0a1~1324 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c206f0d1375fab7b58c19a6be3e68e316f718c66;p=thirdparty%2FPython%2Fcpython.git bpo-34136: Make test_do_not_recreate_annotations more lenient. (GH-8437) --- diff --git a/Lib/test/test_opcodes.py b/Lib/test/test_opcodes.py index 20de3867bfae..b2a22861880f 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):