diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2021-12-05 21:02:47 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-05 21:02:47 (GMT) |
commit | f1dd5ed1f35a7ed5c3833c822e9965de2400d77e (patch) | |
tree | 1fb9173c461a963b846622639fa37e550614e80d /Lib/test/test_dataclasses.py | |
parent | beb834292db54fea129dd073cc822179430cee52 (diff) | |
download | cpython-f1dd5ed1f35a7ed5c3833c822e9965de2400d77e.zip cpython-f1dd5ed1f35a7ed5c3833c822e9965de2400d77e.tar.gz cpython-f1dd5ed1f35a7ed5c3833c822e9965de2400d77e.tar.bz2 |
bpo-45662: Fix the repr of InitVar with a type alias to the built-in class (GH-29291)
For example, InitVar[list[int]].
(cherry picked from commit 1fd4de5bddbbf2a97cdbac4d298c89e1156bdc6c)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
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 bcd004f..47075df 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 |