Skip to content

Commit ea62552

Browse files
AniketsyFokko
andauthored
Update tests/expressions/test_expressions.py
Co-authored-by: Fokko Driesprong <[email protected]>
1 parent 7142a55 commit ea62552

File tree

1 file changed

+3
-20
lines changed

1 file changed

+3
-20
lines changed

tests/expressions/test_expressions.py

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -739,26 +739,9 @@ def test_not() -> None:
739739

740740

741741
def test_not_json_serialization_and_deserialization() -> None:
742-
expr = Not(AlwaysFalse())
743-
json_str = expr.model_dump_json()
744-
restored = Not.model_validate_json(json_str)
745-
assert isinstance(restored, AlwaysTrue)
746-
747-
expr2 = Not(Not(AlwaysFalse()))
748-
json_str2 = expr2.model_dump_json()
749-
restored2 = Not.model_validate_json(json_str2)
750-
assert isinstance(restored2, AlwaysFalse)
751-
752-
class DummyExpr(BooleanExpression):
753-
def __invert__(self) -> BooleanExpression:
754-
return self
755-
756-
dummy = DummyExpr()
757-
not_dummy = Not(child=dummy)
758-
json_str3 = not_dummy.model_dump_json()
759-
restored3 = Not.model_validate_json(json_str3)
760-
assert isinstance(restored3, Not)
761-
assert isinstance(restored3.child, DummyExpr)
742+
not_expr = Not(GreaterThan("a", 22))
743+
json_str = not_expr.model_dump_json()
744+
assert json_str == """{"type":"not","child":{"term":"a","type":"gt","value":22}}"""
762745

763746

764747
def test_always_true() -> None:

0 commit comments

Comments
 (0)