Skip to content

Fix chaining to work and still print True/False#19

Open
charlesdunbar wants to merge 2 commits intovesln:masterfrom
charlesdunbar:fix_chaining
Open

Fix chaining to work and still print True/False#19
charlesdunbar wants to merge 2 commits intovesln:masterfrom
charlesdunbar:fix_chaining

Conversation

@charlesdunbar
Copy link

Description

Currently, chaining does not work per the README as the match returns a boolean instead of an
expect. This fixes it to still work with multiple expects, while still allowing for True/False to be printed via an interactive prompt

Examples

Current code, on a prompt:

>>> from robber import expect
>>> expect(1 + 1).to.be.an.integer()
True
>>> expect(1 + 1).to.be.an.integer().within(1,3)
AttributeError: 'bool' object has no attribute 'within'
>>> expect(1 + 1).to.be.an.integer().within(5,10)
AttributeError: 'bool' object has no attribute 'within'

With this PR:

>>> from robber import expect
>>> expect(1 + 1).to.be.an.integer()
True
>>> expect(1 + 1).to.be.an.integer().within(1,3)
True
>>> expect(1 + 1).to.be.an.integer().within(5,10)
robber.bad_expectation.BadExpectation:
A = 2
B = 5
C = 10
Expected A to be within B and C

Currently, chaining does not work as the match returns a boolean instead of an
expect.  This fixes it to still work with multiple expects, while still
allowing for True/False to be printed via an interactive prompt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant