cpython: 50424a903593 (original) (raw)
Mercurial > cpython
changeset 106020:50424a903593 3.6
Fix unittest.mock._Call: don't ignore name Issue #28961: Fix unittest.mock._Call helper: don't ignore the name parameter anymore. Patch written by Jiajun Huang. [#28961]
Victor Stinner victor.stinner@gmail.com | |
---|---|
date | Fri, 06 Jan 2017 18:15:51 +0100 |
parents | b14a1e81c34a |
children | 7a9b8e9a60b8 f8e24a0a1124 |
files | Lib/unittest/mock.py Lib/unittest/test/testmock/testhelpers.py Misc/NEWS |
diffstat | 3 files changed, 18 insertions(+), 2 deletions(-)[+] [-] Lib/unittest/mock.py 3 Lib/unittest/test/testmock/testhelpers.py 14 Misc/NEWS 3 |
line wrap: on
line diff
--- a/Lib/unittest/mock.py +++ b/Lib/unittest/mock.py @@ -1961,9 +1961,8 @@ class _Call(tuple): If the _Call has no name then it will match any name. """
name = ''[](#l1.10) args = ()[](#l1.11) kwargs = {}[](#l1.12) _len = len(value)[](#l1.13)
--- a/Lib/unittest/test/testmock/testhelpers.py +++ b/Lib/unittest/test/testmock/testhelpers.py @@ -306,6 +306,20 @@ class CallTest(unittest.TestCase): other_args = _Call(((1, 2), {'a': 3})) self.assertEqual(args, other_args)
- def test_call_with_name(self):
self.assertEqual([](#l2.8)
'foo',[](#l2.9)
_Call((), 'foo')[0],[](#l2.10)
)[](#l2.11)
self.assertEqual([](#l2.12)
'',[](#l2.13)
_Call((('bar', 'barz'), ), )[0][](#l2.14)
)[](#l2.15)
self.assertEqual([](#l2.16)
'',[](#l2.17)
_Call((('bar', 'barz'), {'hello': 'world'}), )[0][](#l2.18)
)[](#l2.19)
+ class SpecSignatureTest(unittest.TestCase):
--- a/Misc/NEWS +++ b/Misc/NEWS @@ -42,6 +42,9 @@ Core and Builtins Library ------- +- Issue #28961: Fix unittest.mock._Call helper: don't ignore the name parameter