mirror of
https://github.com/python/cpython.git
synced 2025-08-09 11:29:45 +00:00
[3.12] gh-127537: Add __class_getitem__ to the python implementation of functools.partial (#127537) (#128282)
gh-127537: Add __class_getitem__ to the python implementation of functools.partial (#127537)
(cherry picked from commit 401bba6b58
)
Co-authored-by: CF Bolz-Tereick <cfbolz@gmx.de>
This commit is contained in:
parent
f699151c87
commit
82dbfbfec9
3 changed files with 15 additions and 0 deletions
|
@ -390,6 +390,13 @@ class TestPartial:
|
|||
f = self.partial(object)
|
||||
self.assertRaises(TypeError, f.__setstate__, BadSequence())
|
||||
|
||||
def test_partial_genericalias(self):
|
||||
alias = self.partial[int]
|
||||
self.assertIs(alias.__origin__, self.partial)
|
||||
self.assertEqual(alias.__args__, (int,))
|
||||
self.assertEqual(alias.__parameters__, ())
|
||||
|
||||
|
||||
@unittest.skipUnless(c_functools, 'requires the C _functools module')
|
||||
class TestPartialC(TestPartial, unittest.TestCase):
|
||||
if c_functools:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue