summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_grammar.py
diff options
context:
space:
mode:
authorlarryhastings <larry@hastings.org>2021-04-30 03:09:08 (GMT)
committerGitHub <noreply@github.com>2021-04-30 03:09:08 (GMT)
commit2f2b69855d6524e15d12c15ddc0adce629e7de84 (patch)
treeaac6542c35708f45670fc5ae027a9fc1802e8498 /Lib/test/test_grammar.py
parentdbe60ee09dc5a624cfb78dff61ecf050a5b3f105 (diff)
downloadcpython-2f2b69855d6524e15d12c15ddc0adce629e7de84.zip
cpython-2f2b69855d6524e15d12c15ddc0adce629e7de84.tar.gz
cpython-2f2b69855d6524e15d12c15ddc0adce629e7de84.tar.bz2
bpo-43901: Lazy-create an empty annotations dict in all unannotated user classes and modules (#25623)
Change class and module objects to lazy-create empty annotations dicts on demand. The annotations dicts are stored in the object's `__dict__` for backwards compatibility.
Diffstat (limited to 'Lib/test/test_grammar.py')
-rw-r--r--Lib/test/test_grammar.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py
index 6f79e19..46f70e5 100644
--- a/Lib/test/test_grammar.py
+++ b/Lib/test/test_grammar.py
@@ -382,8 +382,7 @@ class GrammarTests(unittest.TestCase):
self.assertEqual(CC.__annotations__['xx'], 'ANNOT')
def test_var_annot_module_semantics(self):
- with self.assertRaises(AttributeError):
- print(test.__annotations__)
+ self.assertEqual(test.__annotations__, {})
self.assertEqual(ann_module.__annotations__,
{1: 2, 'x': int, 'y': str, 'f': typing.Tuple[int, int]})
self.assertEqual(ann_module.M.__annotations__,