mirror of
https://github.com/python/cpython.git
synced 2025-11-25 12:44:13 +00:00
Issue #7830: Flatten nested functools.partial.
This commit is contained in:
parent
e2e178e081
commit
e49af34151
4 changed files with 68 additions and 7 deletions
|
|
@ -131,6 +131,16 @@ class TestPartial:
|
|||
join = self.partial(''.join)
|
||||
self.assertEqual(join(data), '0123456789')
|
||||
|
||||
def test_nested_optimization(self):
|
||||
partial = self.partial
|
||||
# Only "true" partial is optimized
|
||||
if partial.__name__ != 'partial':
|
||||
return
|
||||
inner = partial(signature, 'asdf')
|
||||
nested = partial(inner, bar=True)
|
||||
flat = partial(signature, 'asdf', bar=True)
|
||||
self.assertEqual(signature(nested), signature(flat))
|
||||
|
||||
|
||||
@unittest.skipUnless(c_functools, 'requires the C _functools module')
|
||||
class TestPartialC(TestPartial, unittest.TestCase):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue