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:
--- /dev/null
+Add missing ``__class_getitem__`` method to the Python implementation of
+:func:`functools.partial`, to make it compatible with the C version. This is
+mainly relevant for alternative Python implementations like PyPy and
+GraalPy, because CPython will usually use the C-implementation of that
+function.