diff -r c6e0c29913ec Lib/unittest/mock.py --- a/Lib/unittest/mock.py Thu Sep 03 15:35:33 2015 -0700 +++ b/Lib/unittest/mock.py Fri Sep 04 16:36:11 2015 +1200 @@ -2005,8 +2005,7 @@ 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 @@ 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 diff -r c6e0c29913ec Lib/unittest/test/testmock/testmock.py --- a/Lib/unittest/test/testmock/testmock.py Thu Sep 03 15:35:33 2015 -0700 +++ b/Lib/unittest/test/testmock/testmock.py Fri Sep 04 16:36:11 2015 +1200 @@ -299,7 +299,9 @@ ]) 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()