summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-02-15 14:22:11 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-02-15 14:22:11 (GMT)
commit90caf017eecdc3e734df144ec793af4dda21953e (patch)
tree7f04a390e32aed241c2e2aad505c1435cb0e4611 /Lib
parentc86ca26d3201d58a33cdc28dfbd49f9a84122d06 (diff)
parent0aa74e10bb7697db00514d62269ff9cae7bd7af9 (diff)
downloadcpython-90caf017eecdc3e734df144ec793af4dda21953e.zip
cpython-90caf017eecdc3e734df144ec793af4dda21953e.tar.gz
cpython-90caf017eecdc3e734df144ec793af4dda21953e.tar.bz2
Issue #19681: Test the repr of partial with more than one keyword argument.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_functools.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py
index fbb43e4..55b96b4 100644
--- a/Lib/test/test_functools.py
+++ b/Lib/test/test_functools.py
@@ -155,9 +155,9 @@ class TestPartialC(TestPartial, unittest.TestCase):
def test_repr(self):
args = (object(), object())
args_repr = ', '.join(repr(a) for a in args)
- #kwargs = {'a': object(), 'b': object()}
- kwargs = {'a': object()}
- kwargs_repr = ', '.join("%s=%r" % (k, v) for k, v in kwargs.items())
+ kwargs = {'a': object(), 'b': object()}
+ kwargs_reprs = ['a={a!r}, b={b!r}'.format_map(kwargs),
+ 'b={b!r}, a={a!r}'.format_map(kwargs)]
if self.partial is c_functools.partial:
name = 'functools.partial'
else:
@@ -172,12 +172,14 @@ class TestPartialC(TestPartial, unittest.TestCase):
repr(f))
f = self.partial(capture, **kwargs)
- self.assertEqual('{}({!r}, {})'.format(name, capture, kwargs_repr),
- repr(f))
+ self.assertIn(repr(f),
+ ['{}({!r}, {})'.format(name, capture, kwargs_repr)
+ for kwargs_repr in kwargs_reprs])
f = self.partial(capture, *args, **kwargs)
- self.assertEqual('{}({!r}, {}, {})'.format(name, capture, args_repr, kwargs_repr),
- repr(f))
+ self.assertIn(repr(f),
+ ['{}({!r}, {}, {})'.format(name, capture, args_repr, kwargs_repr)
+ for kwargs_repr in kwargs_reprs])
def test_pickle(self):
f = self.partial(signature, 'asdf', bar=True)