EastAgile / robber.py

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

[f] - Better message for when dict keys do not match #68

Closed steadykhoi closed 5 years ago

steadykhoi commented 6 years ago

Description

Previously when doing expect(dict_a).to.eq(dict_b) if the 2 dictionaries has different number of keys it will just display this unhelpful message: "A and B does not have the same length". Now it will tell which key is missing "A has key 'foo' while B does not" or "B has key 'bar' while A does not".

Usage

dict_a = dict()
dict_b = {'foo': 2}
expect(dict_a).to.eq(dict_b)
# robber.bad_expectation.BadExpectation:
# B has key 'foo' while A does not
expect(dict_b).to.eq(dict_a)
# robber.bad_expectation.BadExpectation:
# A has key 'foo' while B does not

Secondary changes

steadykhoi commented 6 years ago

@oyster

coveralls commented 6 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling c665054b808d694b949a41338f1719480bbac1bf on feature/better-message-when-dict-dont-match into a10a7f30126a113f92b067982551fad27f6730b8 on master.

oyster commented 6 years ago

Not sure why the test coverage drops. Could you please help to check again? Thanks.

oyster commented 6 years ago

@steadykhoi and @anhtran11, any more update on this?

steadykhoi commented 5 years ago

@oyster Sorry I completely forgot about this PR. But we still need this small changes as we continue to use robber in a lot of our projects. Please review again, thanks!

oyster commented 5 years ago

Thanks. Merging now.