diff options
author | Berker Peksag <berker.peksag@gmail.com> | 2015-09-09 20:35:25 (GMT) |
---|---|---|
committer | Berker Peksag <berker.peksag@gmail.com> | 2015-09-09 20:35:25 (GMT) |
commit | 3fc536f1c95abdd57bc4172fb8eb96fd86cab4d3 (patch) | |
tree | ce314beaf09bd4a8891a8d815cb1d022dd289c7a /Lib/unittest/mock.py | |
parent | d1a98587fe3bc60985c6d6c36b8cf52f1f57750b (diff) | |
download | cpython-3fc536f1c95abdd57bc4172fb8eb96fd86cab4d3.zip cpython-3fc536f1c95abdd57bc4172fb8eb96fd86cab4d3.tar.gz cpython-3fc536f1c95abdd57bc4172fb8eb96fd86cab4d3.tar.bz2 |
Issue #24857: Comparing call_args to a long sequence now correctly returns a
boolean result instead of raising an exception.
Patch by A Kaptur.
Diffstat (limited to 'Lib/unittest/mock.py')
-rw-r--r-- | Lib/unittest/mock.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py index ec3f2f9..573c799 100644 --- a/Lib/unittest/mock.py +++ b/Lib/unittest/mock.py @@ -1986,8 +1986,7 @@ class _Call(tuple): else: other_args = () other_kwargs = value - else: - # len 2 + elif len_other == 2: # could be (name, args) or (name, kwargs) or (args, kwargs) first, second = other if isinstance(first, str): @@ -1998,6 +1997,8 @@ class _Call(tuple): other_args, other_kwargs = (), second else: other_args, other_kwargs = first, second + else: + return False if self_name and other_name != self_name: return False |