summaryrefslogtreecommitdiffstats
path: root/Lib/unittest/test/testmock/testmock.py
diff options
context:
space:
mode:
authorKushal Das <kushaldas@gmail.com>2014-06-09 08:15:56 (GMT)
committerKushal Das <kushaldas@gmail.com>2014-06-09 08:15:56 (GMT)
commit047f14c3c6ed39371fab2d93db8dfd5b5fdb06f1 (patch)
treec3b9bd6d71958bed15ed603d96dca6761d82c928 /Lib/unittest/test/testmock/testmock.py
parent85e4235c0e702b180f3f50b0124fd40c2f460be0 (diff)
downloadcpython-047f14c3c6ed39371fab2d93db8dfd5b5fdb06f1.zip
cpython-047f14c3c6ed39371fab2d93db8dfd5b5fdb06f1.tar.gz
cpython-047f14c3c6ed39371fab2d93db8dfd5b5fdb06f1.tar.bz2
Closes #21256: Printout of keyword args in deterministic order in mock calls.
Printout of keyword args should be in deterministic order in a mock function call. This will help to write better doctests.
Diffstat (limited to 'Lib/unittest/test/testmock/testmock.py')
-rw-r--r--Lib/unittest/test/testmock/testmock.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/unittest/test/testmock/testmock.py b/Lib/unittest/test/testmock/testmock.py
index b65dc32..7019ee9 100644
--- a/Lib/unittest/test/testmock/testmock.py
+++ b/Lib/unittest/test/testmock/testmock.py
@@ -1206,6 +1206,12 @@ class MockTest(unittest.TestCase):
with self.assertRaises(AssertionError):
m.hello.assert_not_called()
+ #Issue21256 printout of keyword args should be in deterministic order
+ def test_sorted_call_signature(self):
+ m = Mock()
+ m.hello(name='hello', daddy='hero')
+ text = "call(daddy='hero', name='hello')"
+ self.assertEquals(repr(m.hello.call_args), text)
def test_mock_add_spec(self):
class _One(object):