Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
9d607061
Commit
9d607061
authored
Sep 09, 2019
by
Xtreak
Committed by
Zachary Ware
Sep 09, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-37212: Preserve keyword argument order in unittest.mock.call and error messages (GH-14310)
parent
63c98ed2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
4 deletions
+6
-4
Lib/unittest/mock.py
Lib/unittest/mock.py
+1
-1
Lib/unittest/test/testmock/testmock.py
Lib/unittest/test/testmock/testmock.py
+3
-3
Misc/NEWS.d/next/Library/2019-06-22-22-00-35.bpo-37212.Zhv-tq.rst
...S.d/next/Library/2019-06-22-22-00-35.bpo-37212.Zhv-tq.rst
+2
-0
No files found.
Lib/unittest/mock.py
View file @
9d607061
...
...
@@ -2320,7 +2320,7 @@ def _format_call_signature(name, args, kwargs):
formatted_args
=
''
args_string
=
', '
.
join
([
repr
(
arg
)
for
arg
in
args
])
kwargs_string
=
', '
.
join
([
'%s=%r'
%
(
key
,
value
)
for
key
,
value
in
sorted
(
kwargs
.
items
()
)
'%s=%r'
%
(
key
,
value
)
for
key
,
value
in
kwargs
.
items
(
)
])
if
args_string
:
formatted_args
=
args_string
...
...
Lib/unittest/test/testmock/testmock.py
View file @
9d607061
...
...
@@ -1571,11 +1571,11 @@ class MockTest(unittest.TestCase):
m.assert_called_once()
self.assertNotIn("Calls:", str(e.exception))
#Issue
21256 printout of keyword args should be in deterministic
order
def test_
sort
ed_call_signature(self):
#Issue
37212 printout of keyword args now preserves the original
order
def test_
order
ed_call_signature(self):
m = Mock()
m.hello(name='
hello
', daddy='
hero
')
text = "call(
daddy='
hero
', name='
hell
o
')"
text = "call(
name='
hello
', daddy='
her
o
')"
self.assertEqual(repr(m.hello.call_args), text)
#Issue21270 overrides tuple methods for mock.call objects
...
...
Misc/NEWS.d/next/Library/2019-06-22-22-00-35.bpo-37212.Zhv-tq.rst
0 → 100644
View file @
9d607061
:func:`unittest.mock.call` now preserves the order of keyword arguments in
repr output. Patch by Karthikeyan Singaravelan.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment