Skip to content

Commit

Permalink
bpo-34136: Make test_do_not_recreate_annotations more lenient. (pytho…
Browse files Browse the repository at this point in the history
  • Loading branch information
serhiy-storchaka committed Jul 24, 2018
1 parent d19d8d5 commit c206f0d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Lib/test/test_opcodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,13 @@ def test_use_existing_annotations(self):
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):

Expand Down

0 comments on commit c206f0d

Please sign in to comment.