Enhancements: expect/result syntax sugar and better Mock.__repr__
Bug #278244 reported by
Daniel
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mocker |
Invalid
|
Undecided
|
Gustavo Niemeyer |
Bug Description
I have written two new methods for the Mock class that make it easier to perform expect(
These are equivalent:
sweet: mock.func(arg) << value
sour: expect(
And these are equivalent:
sweet: (mock.func(arg) >> value).value_func()
sour: expect(
Implementation attached.
I have also included a __repr__ function for the Mock class that makes it easier to debug test failures. I know it should technically be submitted as a separate bug, but I'm lazy.
To post a comment you must log in.
By design, Mock objects do not have any special syntax attached to themselves, because that would conflict with the implementation of the same methods on real objects.