EastAgile / robber.py

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

Chain matcher's unexpected behaviors #51

Closed catriuspham closed 7 years ago

catriuspham commented 7 years ago

Running this expect(expect).to.have.chain('to') in ipython returns AttributeError. But running the same code with nosetests still passes.

hieueastagile commented 7 years ago

Can you give me a full piece of code @catriuspham?

catriuspham commented 7 years ago

@hieueastagile I found out the problem. nosetests automatically runs through the test/__init__.py which imports the chain_matcher.

hieueastagile commented 7 years ago

I don't really get it, could you give more code and explanation?

catriuspham commented 7 years ago

You can see that in tests/test_expect.py we have a lot of tests that use chain matcher. And all tests pass when running nosetests. Then I use ipython and run the exact same code from the line 29 in tests/test_expect.py which is expect(expect).to.have.chain('to'), and it raises AttributeError: 'expect' object has no attribute 'chain'.

catriuspham commented 7 years ago

So I think this behavior is expected, the chain matcher is only available for testing purpose. It's a feature, not a bug :laughing: