File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2005,8 +2005,7 @@ def __eq__(self, other):
20052005 else :
20062006 other_args = ()
20072007 other_kwargs = value
2008- else :
2009- # len 2
2008+ elif len_other == 2 :
20102009 # could be (name, args) or (name, kwargs) or (args, kwargs)
20112010 first , second = other
20122011 if isinstance (first , str ):
@@ -2017,6 +2016,8 @@ def __eq__(self, other):
20172016 other_args , other_kwargs = (), second
20182017 else :
20192018 other_args , other_kwargs = first , second
2019+ else :
2020+ return False
20202021
20212022 if self_name and other_name != self_name :
20222023 return False
Original file line number Diff line number Diff line change @@ -300,6 +300,9 @@ def test_call_args_comparison(self):
300300 self .assertEqual (mock .call_args ,
301301 ((sentinel .Arg ,), {"kw" : sentinel .Kwarg }))
302302
303+ # Comparing call_args to a long sequence should not raise
304+ # an exception. See issue 24857.
305+ self .assertFalse (mock .call_args == "a long sequence" )
303306
304307 def test_assert_called_with (self ):
305308 mock = Mock ()
Original file line number Diff line number Diff line change @@ -98,6 +98,9 @@ Core and Builtins
9898Library
9999-------
100100
101+ - Issue #24857: Comparing call_args to a long sequence now correctly returns a
102+ boolean result instead of raising an exception. Patch by A Kaptur.
103+
101104- Issue #23144: Make sure that HTMLParser.feed() returns all the data, even
102105 when convert_charrefs is True.
103106
You can’t perform that action at this time.
0 commit comments