Skip to content

Commit

Permalink
add ordering to answers
Browse files Browse the repository at this point in the history
  • Loading branch information
marcocapozzoli committed Mar 11, 2024
1 parent c021ab6 commit 36aed0b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[#165] Improve error messages during requests to Functions
[#180] Fix in the test_metta_api.py integration test
13 changes: 10 additions & 3 deletions tests/integration/test_metta_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,16 @@ def test_match_nested_expression(self):

answer = [query_answer for query_answer in das.query(query_3)]
assert len(answer) == 2
handle = answer[0].assignment.mapping["$v2"]

# Sort the answer list based on the handle
answer.sort(key=lambda x: x.assignment.mapping["$v2"])

handle = answer[1].assignment.mapping["$v2"]
assert handle == '9f27a331633c8bc3c49435ffabb9110e'
symbol = das.get_atom(handle)
assert symbol["type"] == "Symbol"
assert symbol["name"] == "2"
handle = answer[1].assignment.mapping["$v2"]
handle = answer[0].assignment.mapping["$v2"]
assert handle == '233d9a6da7d49d4164d863569e9ab7b6'
symbol = das.get_atom(handle)
assert symbol["type"] == "Expression"
Expand Down Expand Up @@ -137,8 +141,11 @@ def test_match_nested_expression(self):
)

answer = [query_answer for query_answer in das.query(query_4)]

assert len(answer) == 2

# Sort the answer list based on the $v handle
answer.sort(key=lambda x: x.assignment.mapping["$v"])

handle = answer[0].assignment.mapping["$v"]
assert handle == '963d66edfb77236054125e3eb866c8b5'
symbol = das.get_atom(handle)
Expand Down

0 comments on commit 36aed0b

Please sign in to comment.