summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-07-24 12:05:28 (GMT)
committerGitHub <noreply@github.com>2018-07-24 12:05:28 (GMT)
commitc206f0d1375fab7b58c19a6be3e68e316f718c66 (patch)
treeb9f7bf7615a3e64bcc0e41612f1bc43b8d74988e
parentd19d8d5279f156bc8f6736b5f16f069879b9519b (diff)
downloadcpython-c206f0d1375fab7b58c19a6be3e68e316f718c66.zip
cpython-c206f0d1375fab7b58c19a6be3e68e316f718c66.tar.gz
cpython-c206f0d1375fab7b58c19a6be3e68e316f718c66.tar.bz2
bpo-34136: Make test_do_not_recreate_annotations more lenient. (GH-8437)
-rw-r--r--Lib/test/test_opcodes.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/Lib/test/test_opcodes.py b/Lib/test/test_opcodes.py
index 20de386..b2a22861 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):