[Python-checkins] cpython (merge 3.6 -> default): Merge 3.6
victor.stinner
python-checkins at python.org
Fri Jan 6 12:16:31 EST 2017
https://hg.python.org/cpython/rev/7a9b8e9a60b8
changeset: 106021:7a9b8e9a60b8
parent: 106019:4edd6cbf9abf
parent: 106020:50424a903593
user: Victor Stinner <victor.stinner at gmail.com>
date: Fri Jan 06 18:16:07 2017 +0100
summary:
Merge 3.6
files:
Lib/unittest/mock.py | 3 +-
Lib/unittest/test/testmock/testhelpers.py | 14 +++++++++++
Misc/NEWS | 3 ++
3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py
--- a/Lib/unittest/mock.py
+++ b/Lib/unittest/mock.py
@@ -1951,9 +1951,8 @@
If the _Call has no name then it will match any name.
"""
- def __new__(cls, value=(), name=None, parent=None, two=False,
+ def __new__(cls, value=(), name='', parent=None, two=False,
from_kall=True):
- name = ''
args = ()
kwargs = {}
_len = len(value)
diff --git a/Lib/unittest/test/testmock/testhelpers.py b/Lib/unittest/test/testmock/testhelpers.py
--- a/Lib/unittest/test/testmock/testhelpers.py
+++ b/Lib/unittest/test/testmock/testhelpers.py
@@ -306,6 +306,20 @@
other_args = _Call(((1, 2), {'a': 3}))
self.assertEqual(args, other_args)
+ def test_call_with_name(self):
+ self.assertEqual(
+ 'foo',
+ _Call((), 'foo')[0],
+ )
+ self.assertEqual(
+ '',
+ _Call((('bar', 'barz'), ), )[0]
+ )
+ self.assertEqual(
+ '',
+ _Call((('bar', 'barz'), {'hello': 'world'}), )[0]
+ )
+
class SpecSignatureTest(unittest.TestCase):
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -210,6 +210,9 @@
Library
-------
+- Issue #28961: Fix unittest.mock._Call helper: don't ignore the name parameter
+ anymore. Patch written by Jiajun Huang.
+
- Issue #15812: inspect.getframeinfo() now correctly shows the first line of
a context. Patch by Sam Breese.
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list