MarkBerlin78 / pymox

Automatically exported from code.google.com/p/pymox
Apache License 2.0
0 stars 0 forks source link

Mox should format expected versus actual method call discrepancies elegantly. #7

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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.

Original issue reported on code.google.com by matt.proud@gmail.com on 9 Mar 2009 at 9:11

GoogleCodeExporter commented 9 years ago
I'll see if I have some spare time to hack around with this soon.

Original comment by smidd...@gmail.com on 5 May 2009 at 11:08