Skip to content

Commit

Permalink
Merge pull request #15 from cloudblue/fix_null_lookup_for_missed_fields
Browse files Browse the repository at this point in the history
Fix null lookups for missed fields
  • Loading branch information
Francesco Faraone authored Mar 16, 2023
2 parents 663caa2 + 56ccfc8 commit 7f7a841
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion py_rql/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def apply_operator(prop, operator, value, obj):
try:
prop_value = extract_value(obj, prop)
except KeyError:
return False
prop_value = None
result = operator(prop_value, value)
return result

Expand Down
3 changes: 1 addition & 2 deletions tests/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ def test_apply_operator(mocker):


def test_apply_operator_prop_not_found(mocker):
mocked_op = mocker.MagicMock(return_value=True)
mocked_op = mocker.MagicMock(return_value=False)
assert apply_operator('other', mocked_op, 'value_b', {'root': 'value_a'}) is False
mocked_op.assert_not_called()


def test_apply_logical_operator(mocker):
Expand Down

0 comments on commit 7f7a841

Please sign in to comment.