diff options
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/unittest/mock.py | 3 | ||||
-rw-r--r-- | Lib/unittest/test/testmock/testhelpers.py | 14 |
2 files changed, 15 insertions, 2 deletions
diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py index f134919..dcac5a2 100644 --- 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. """ - 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 index 3477634..d5f9e7c 100644 --- 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( + 'foo', + _Call((), 'foo')[0], + ) + self.assertEqual( + '', + _Call((('bar', 'barz'), ), )[0] + ) + self.assertEqual( + '', + _Call((('bar', 'barz'), {'hello': 'world'}), )[0] + ) + class SpecSignatureTest(unittest.TestCase): |