Skip to content

Commit

Permalink
πŸš‘ Hotfix reset negated state closes #32
Browse files Browse the repository at this point in the history
  • Loading branch information
bdsoha committed Dec 8, 2022
1 parent a0a69a1 commit 13df748
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/expycted/internals/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ def _execute_internal_assertion(self, method: str, *args, **kwargs):

@property
def to(self):
self.negate = False

return self

@property
Expand All @@ -59,7 +61,8 @@ def and_to(self):

@property
def to_not(self):
self.negate = not self.negate
self.negate = True

return self

@property
Expand Down
8 changes: 8 additions & 0 deletions test/other_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,11 @@ def test_method_chaining():
assert expect_object.and_to_not is expect_object

expect([1, 2, 3]).to_not.contain(7).and_to.contain(3)


def test_negation_chaining():
expect_object = expect.value(1)

assert expect_object.to.negate is False
assert expect_object.to_not.negate is True
assert expect_object.to_not.to.negate is False

0 comments on commit 13df748

Please sign in to comment.