EastAgile / robber.py

BDD / TDD assertion library for Python
MIT License
8 stars 1 forks source link

Better explaination system #39

Closed catriuspham closed 7 years ago

catriuspham commented 7 years ago

I have looked at Sure's DeepExplaination and come up with an idea for our explanation system. All the failure message will have the following format, from which the second and the third line can be omitted.

BadExpectation:
A = ...
B = ...
C = ...
Expected A to {action} B. 
{more_detail}

For example:

expect(1).to.eq(2)

will show us this error message:

BadExpectation:
A = 1
B = 2
Expected A to equal B. 

Another example:

mock(1, 2, a=3)
expect(mock).to.be.called_with(4, 5, b=6)

gives us this error message:

BadExpectation:
A = [represented string of mock]
B = 1, 2, a=3
C = 4, 5, b=6
Expected A to be called with B.
Actually called with C. 
hieueastagile commented 7 years ago

Sounds good to me :+1:

catriuspham commented 7 years ago

@oyster Please help close this issue also, thanks.