Export to GitHub

pymox - issue #7

Mox should format expected versus actual method call discrepancies elegantly.


Posted on Mar 9, 2009 by Happy Camel

What steps will reproduce the problem? Mock a given method that has a long and complex signature, and have the actual call to the mock not match the recorded call.

mock_my_object = self.mox.CreateMock(MyObject) mock_my_object.SomeComplexMethod(1, 2, 3, 4, 5, 6).AndReturn(True) self.mox.ReplayAll()

self.assertTrue(mock_my_object.SomeComplexMethod(1, 2, 3, 4, 5, 6, 7))

What is the expected output? What do you see instead? I would hope that Mox would more elegantly print where the discrepancy in the method calls is---e.g., "Unequal number of arguments between recorded and called method: 1 extra argument provided." for the case above.

Something like this would be nice:

Expected <MyObject mock>.SomeComplexMethod(1, 2, 3, 4, 5, 6) Actual <MyObject mock>.SomeComplexMethod(1, 2, 3, 4, 5, 6, 7) Extra parameter /|\

What version of the product are you using? On what operating system? 0.5.0 on Linux.

Please provide any additional information below. It can be really hard to read the discrepancy reports of the current version.

Comment #1

Posted on May 5, 2009 by Massive Panda

I'll see if I have some spare time to hack around with this soon.

Status: New

Labels:
Type-Enhancement Priority-Medium