Karthikeyan Singaravelan <[email protected]> added the comment:
Yes, for call objects it's always there but some of the tests use a tuple
during self.assertEquals and hence during equality check other fails with the
attribute error for parent like below. Also getattr(self, 'parent', None) !=
getattr(other, 'parent', None) will skip the attribute error but still fail for
tuples in tests I guess with tuple.parent returned as None and checked against
a valid parent. Hence the patch with both the checks of getattr and self.parent
that passes the test suite. I will wait for input from maintainers if my
approach is correct since I am little new to mock :)
======================================================================
ERROR: test_explicit_mock (unittest.test.testmock.testwith.TestMockOpen)
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/unittest/test/testmock/testwith.py",
line 177, in test_explicit_mock
mock.assert_called_once_with('foo')
File
"/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/unittest/mock.py",
line 838, in assert_called_once_with
return self.assert_called_with(*args, **kwargs)
File
"/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/unittest/mock.py",
line 823, in assert_called_with
if expected != actual:
File
"/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/unittest/mock.py",
line 2057, in __eq__
if self.parent != other.parent:
AttributeError: 'tuple' object has no attribute 'parent'
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue35226>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com