Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/jsonata/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,10 @@ def is_deep_equal(lhs: Optional[Any], rhs: Optional[Any]) -> bool:
if not Utils.is_deep_equal(lhs[key], rhs[key]):
return False
return True
if lhs == rhs and type(lhs) == type(rhs):
if lhs == rhs:
if isinstance(lhs, bool) != isinstance(rhs, bool):
return False
return True

return False

class JList(list):
Expand Down
15 changes: 15 additions & 0 deletions tests/types_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,18 @@ def test_fix_issue_21(self):
"""
assert jsonata.Jsonata("true = 1").evaluate({}) is False
assert jsonata.Jsonata("false = 0").evaluate({}) is False

def test_fix_issue_23(self):
"""
https://github.com/rayokota/jsonata-python/issues/23
"""
class PlainScalarString(str):
pass

data = {
"foo": [
{"some_attr": PlainScalarString("some_value"), "bar": 17},
{"some_attr": PlainScalarString("other_value"), "bar": 19},
]
}
assert jsonata.Jsonata('foo[some_attr="some_value"].bar').evaluate(data) == 17
Loading