summaryrefslogtreecommitdiff
path: root/mock/tests
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-01-06 18:15:51 +0100
committerChris Withers <chris@withers.org>2019-04-30 08:39:55 +0100
commitf9efc3e82452b7a7c936d85ff08eb9368a2f03eb (patch)
tree1c1b7881c0f2dafd22c0b8e697f5645675090d16 /mock/tests
parent8307e8504de439448edb99e3c77fe4c601a40ef8 (diff)
downloadmock-f9efc3e82452b7a7c936d85ff08eb9368a2f03eb.tar.gz
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. Backports: 84b6fb0eea29b3b28a1a11124526b01ec0c9d17a Signed-off-by: Chris Withers <chris@simplistix.co.uk>
Diffstat (limited to 'mock/tests')
-rw-r--r--mock/tests/testhelpers.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/mock/tests/testhelpers.py b/mock/tests/testhelpers.py
index 66dbb3f..d402ca9 100644
--- a/mock/tests/testhelpers.py
+++ b/mock/tests/testhelpers.py
@@ -315,6 +315,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):