mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Issue #24857: Comparing call_args to a long sequence now correctly returns a
boolean result instead of raising an exception. Patch by A Kaptur.
This commit is contained in:
commit
29bf4d403d
3 changed files with 9 additions and 2 deletions
|
@ -2005,8 +2005,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):
|
||||
|
@ -2017,6 +2016,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
|
||||
|
|
|
@ -300,6 +300,9 @@ class MockTest(unittest.TestCase):
|
|||
self.assertEqual(mock.call_args,
|
||||
((sentinel.Arg,), {"kw": sentinel.Kwarg}))
|
||||
|
||||
# Comparing call_args to a long sequence should not raise
|
||||
# an exception. See issue 24857.
|
||||
self.assertFalse(mock.call_args == "a long sequence")
|
||||
|
||||
def test_assert_called_with(self):
|
||||
mock = Mock()
|
||||
|
|
|
@ -14,6 +14,9 @@ Core and Builtins
|
|||
Library
|
||||
-------
|
||||
|
||||
- Issue #24857: Comparing call_args to a long sequence now correctly returns a
|
||||
boolean result instead of raising an exception. Patch by A Kaptur.
|
||||
|
||||
- Issue #23144: Make sure that HTMLParser.feed() returns all the data, even
|
||||
when convert_charrefs is True.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue