summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_functools.py
diff options
context:
space:
mode:
authorAlexander Belopolsky <alexander.belopolsky@gmail.com>2015-03-01 20:08:17 (GMT)
committerAlexander Belopolsky <alexander.belopolsky@gmail.com>2015-03-01 20:08:17 (GMT)
commite49af341518ba22186fc523ec23ccff462ab439e (patch)
tree0c426b6e661d637c14c2d9c467a99580b985fb4a /Lib/test/test_functools.py
parente2e178e081a621d2c1fd8ceb65ce7735b3036def (diff)
downloadcpython-e49af341518ba22186fc523ec23ccff462ab439e.zip
cpython-e49af341518ba22186fc523ec23ccff462ab439e.tar.gz
cpython-e49af341518ba22186fc523ec23ccff462ab439e.tar.bz2
Issue #7830: Flatten nested functools.partial.
Diffstat (limited to 'Lib/test/test_functools.py')
-rw-r--r--Lib/test/test_functools.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py
index 55b96b4..c549ac4 100644
--- a/Lib/test/test_functools.py
+++ b/Lib/test/test_functools.py
@@ -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):