summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_genericalias.py
diff options
context:
space:
mode:
authorJelle Zijlstra <jelle.zijlstra@gmail.com>2022-05-02 19:21:59 (GMT)
committerGitHub <noreply@github.com>2022-05-02 19:21:59 (GMT)
commitff88f7e007deb7a9f7539938dcf6f4adbfebf442 (patch)
treef6db3ea58a6b68abaacb2311461208849364b0e9 /Lib/test/test_genericalias.py
parent56f98440148e4257aa5b27150ce2269c98cea0ea (diff)
downloadcpython-ff88f7e007deb7a9f7539938dcf6f4adbfebf442.zip
cpython-ff88f7e007deb7a9f7539938dcf6f4adbfebf442.tar.gz
cpython-ff88f7e007deb7a9f7539938dcf6f4adbfebf442.tar.bz2
gh-87390: Add __unpacked__ attribute to types.GenericAlias (#92059)
Diffstat (limited to 'Lib/test/test_genericalias.py')
-rw-r--r--Lib/test/test_genericalias.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_genericalias.py b/Lib/test/test_genericalias.py
index 635ac0f..2d2adc1 100644
--- a/Lib/test/test_genericalias.py
+++ b/Lib/test/test_genericalias.py
@@ -418,6 +418,12 @@ class BaseTest(unittest.TestCase):
self.assertEqual(copied.__args__, alias.__args__)
self.assertEqual(copied.__parameters__, alias.__parameters__)
+ def test_unpack(self):
+ alias = tuple[str, ...]
+ self.assertIs(alias.__unpacked__, False)
+ unpacked = (*alias,)[0]
+ self.assertIs(unpacked.__unpacked__, True)
+
def test_union(self):
a = typing.Union[list[int], list[str]]
self.assertEqual(a.__args__, (list[int], list[str]))