EastAgile / robber.py

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

Improve failing message of .eq #25

Closed hieueastagile closed 7 years ago

hieueastagile commented 7 years ago

Currently, our failing message for assert 2 objects is too hard to read, for example:

BadExpectation: 'Expected "[({\'middle_initial\': \'M\', \'first_name\': \'Jeffery\', \'last_name\': \'Aaron\', \'gender\': \'M\', \'resignation_date\': datetime.date(2004, 2, 12), \'race\': \'White\', \'rank\': \'Police Officer\', \'appointed_date\': datetime.date(2005, 9, 29), \'on_duty\': False, \'birth_year\': 1992}, [12345, 23456])]" to equal "[{\'last_name\': \'Aaron\', \'star\': [12345, 23456], \'rank\': \'Police Officer\', \'appointed_date\': datetime.date(2005, 9, 29), \'middle_initial\': \'M\', \'first_name\': \'Jeffery\', \'gender\': \'M\', \'resignation_date\': datetime.date(2004, 2, 12), \'race\': \'White\', \'on_duty\': False, \'birth_year\': 1992}]"'

We might need to improve this to have a better diff explanation or at least pointing out where are the differences between 2 of them, add coloring if needed. We can reference sure for this, they did it really well.

catriuspham commented 7 years ago

This was fixed in https://github.com/EastAgile/robber.py/pull/31

catriuspham commented 7 years ago

@oyster Please help close this issue