Python mock object instantiation
<p>Using Python 2.7, and mock library</p>

<p>How can I test that certain patched object has been initialized with some specific arguments using mock?</p>

<p>Here some sample code and pseudo-code:</p>

<p>unittest.py :</p>

<pre><code>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...
</code></pre>

<p>mylib.py :</p>

<pre><code>from someobjectmodule import SomeObject
def method_to_test():
  obj = SomeObject(arg1=val1, arg2=val2, arg3=val3)
  obj.method_inside_someobject()
</code></pre>

<p>So, how can I test SomeObject was instanced with arg1=val1, arg2=val2, arg3=val3?</p>