Keeps track of the usage of a MiniMock-ed object, and allows for that usage to be analysed after the fact.
Compare expected MiniMock usage with that which we expected.
Parameters: |
|
---|---|
Return type: | a True value if the check passed, False otherwise |
Example:
>>> from minimock import Mock
>>> tt = TraceTracker()
>>> m = Mock('mock_obj', tracker=tt)
>>> m.some_meth('dummy argument')
>>> tt.check("Called mock_obj.some_meth('dummy argument')")
True
>>> tt.check("Failing expected trace")
False
Compare expected MiniMock usage with that which we expected.
Parameters: |
|
---|---|
Return type: | a True value if the check passed, False otherwise |
Example:
>>> from minimock import Mock
>>> tt = TraceTracker()
>>> m = Mock('mock_obj', tracker=tt)
>>> m.some_meth('dummy argument')
>>> tt.diff("Dummy string")
"Expected:\n Dummy string\nGot:\n Called mock_obj.some_meth('dummy argument')\n"
Return the MiniMock usage so far.
Example:
>>> from minimock import Mock
>>> tt = TraceTracker()
>>> m = Mock('mock_obj', tracker=tt)
>>> m.some_meth('dummy argument')
>>> tt.dump()
"Called mock_obj.some_meth('dummy argument')\n"
Check the usage of a mm_unit.TraceTracker is as expected.
Parameters: |
|
---|---|
Raises: | AssertionError if the expected and observed outputs don’t match |
Example:
>>> from minimock import Mock
>>> tt = TraceTracker()
>>> m = Mock('mock_obj', tracker=tt)
>>> m.some_meth('dummy argument')
>>> assert_same_trace(tt,
... "Called mock_obj.some_meth('dummy argument')\n")