Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset negated state after each assertion #22

Closed
bdsoha opened this issue Dec 4, 2022 · 0 comments · Fixed by #23
Closed

Reset negated state after each assertion #22

bdsoha opened this issue Dec 4, 2022 · 0 comments · Fixed by #23

Comments

@bdsoha
Copy link
Owner

bdsoha commented Dec 4, 2022

Reset negated state after each assertion.

Assuming:

def test():
    data = ['hello']

    # Using the `assert` keyword
    assert isinstance(data, list)
    assert len(data) == 1
    assert 'hello' in data
    assert 'world' not in data

    # Using expectations
    expect(data) \
        .to.be_a_list() \
        .and_to.have_len(1) \
        .and_not.contain('world') \
        .and_to.contain('hello') \

This will currently fail due to the chained functionally of .and_not.contain('world') maintaining the negated stated.

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 a pull request may close this issue.

1 participant