Using Python 2.7, and mock library How can I test that certain patched object has been initialized with some specific arguments using mock? Here some sample code and pseudo-code: unittest.py : import mock @mock.patch('mylib.SomeObject') def test_mytest(self, mock_someobject): test1 = mock_someobject.return_value test1 = method_inside_someobject.side_effect = ['something'] mylib.method_to_test() # How can I assert that method_to_test instanced SomeObject with certain arguments? # I further test things with that method_inside_someobject call, no problems there... mylib.py : from someobjectmodule import SomeObject def method_to_test(): obj = SomeObject(arg1=val1, arg2=val2, arg3=val3) obj.method_inside_someobject() So, how can I test SomeObject was instanced with arg1=val1, arg2=val2, arg3=val3? Continue reading...