diff options
author | Batuhan Taskaya <isidentical@gmail.com> | 2021-04-25 02:31:20 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-25 02:31:20 (GMT) |
commit | 8cc3cfa8afab1651c4f6e9ba43a7ab7f10f64c32 (patch) | |
tree | a6a762b7912545a0825028c9ec8a28186e2f1d13 /Lib/test/test_future.py | |
parent | 196983563d05e32d2dcf217e955a919f9e0c25e1 (diff) | |
download | cpython-8cc3cfa8afab1651c4f6e9ba43a7ab7f10f64c32.zip cpython-8cc3cfa8afab1651c4f6e9ba43a7ab7f10f64c32.tar.gz cpython-8cc3cfa8afab1651c4f6e9ba43a7ab7f10f64c32.tar.bz2 |
bpo-42737: annotations with complex targets no longer causes any runtime effects (GH-23952)
Diffstat (limited to 'Lib/test/test_future.py')
-rw-r--r-- | Lib/test/test_future.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_future.py b/Lib/test/test_future.py index e471558..8a09853 100644 --- a/Lib/test/test_future.py +++ b/Lib/test/test_future.py @@ -134,8 +134,12 @@ class AnnotationsFutureTestCase(unittest.TestCase): ... async def g2(arg: {ann}) -> None: ... + class H: + var: {ann} + object.attr: {ann} var: {ann} var2: {ann} = None + object.attr: {ann} """ ) @@ -343,6 +347,13 @@ class AnnotationsFutureTestCase(unittest.TestCase): self.assertAnnotationEqual("('inf', 1e1000, 'infxxx', 1e1000j)", expected=f"('inf', {inf}, 'infxxx', {infj})") self.assertAnnotationEqual("(1e1000, (1e1000j,))", expected=f"({inf}, ({infj},))") + def test_annotation_with_complex_target(self): + with self.assertRaises(SyntaxError): + exec( + "from __future__ import annotations\n" + "object.__debug__: int" + ) + if __name__ == "__main__": unittest.main() |