Skip to content

Commit

Permalink
fix: default assertion for satisfies check. (#183)
Browse files Browse the repository at this point in the history
  • Loading branch information
poolis authored Jan 8, 2024
1 parent a7ad766 commit 248f50a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pydeequ/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ def satisfies(self, columnCondition, constraintName, assertion=None, hint=None):
assertion_func = (
ScalaFunction1(self._spark_session.sparkContext._gateway, assertion)
if assertion
else getattr(self._Check, "satisfies$default$2")()
else getattr(self._Check, "satisfies$default$3")()
)
hint = self._jvm.scala.Option.apply(hint)
self._Check = self._Check.satisfies(columnCondition, constraintName, assertion_func, hint)
Expand Down
5 changes: 2 additions & 3 deletions tests/test_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1122,9 +1122,8 @@ def test_fail_hasCorrelation(self):
self.assertEqual(self.hasCorrelation("b", "e", lambda x: x == -1), [Row(constraint_status="Failure")])

def test_satisfies(self):
# TODO: test without assertion
# self.assertEqual(self.satisfies('b >=2', 'b greater than or equal to 2'),
# [Row(constraint_status='Failure')])
self.assertEqual(self.satisfies('b >=2', 'b greater than or equal to 2'),
[Row(constraint_status='Failure')])
self.assertEqual(self.satisfies("b >=2", "b", lambda x: x == 2 / 3), [Row(constraint_status="Success")])
self.assertEqual(
self.satisfies("b >=2 AND d >= 2", "b and d", lambda x: x == 2 / 3), [Row(constraint_status="Success")]
Expand Down

0 comments on commit 248f50a

Please sign in to comment.