diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2021-12-05 22:41:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-05 22:41:58 +0200 |
commit | 1fd4de5bddbbf2a97cdbac4d298c89e1156bdc6c (patch) | |
tree | 905cb4c796f82a7ce786b767f63220202f701d07 /Lib/test/test_dataclasses.py | |
parent | 60c320c38e4e95877cde0b1d8562ebd6bc02ac61 (diff) | |
download | cpython-git-1fd4de5bddbbf2a97cdbac4d298c89e1156bdc6c.tar.gz |
bpo-45662: Fix the repr of InitVar with a type alias to the built-in class (GH-29291)
For example, InitVar[list[int]].
Diffstat (limited to 'Lib/test/test_dataclasses.py')
-rw-r--r-- | Lib/test/test_dataclasses.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_dataclasses.py b/Lib/test/test_dataclasses.py index bcd004f4ec..47075df8d5 100644 --- a/Lib/test/test_dataclasses.py +++ b/Lib/test/test_dataclasses.py @@ -1126,6 +1126,10 @@ class TestCase(unittest.TestCase): self.assertEqual(repr(InitVar[int]), 'dataclasses.InitVar[int]') self.assertEqual(repr(InitVar[List[int]]), 'dataclasses.InitVar[typing.List[int]]') + self.assertEqual(repr(InitVar[list[int]]), + 'dataclasses.InitVar[list[int]]') + self.assertEqual(repr(InitVar[int|str]), + 'dataclasses.InitVar[int | str]') def test_init_var_inheritance(self): # Note that this deliberately tests that a dataclass need not |