Skip to content

Commit

Permalink
Fix tests missing type and no iterators equals true (#69)
Browse files Browse the repository at this point in the history
* Add in tests missing expected type in response

* Add no interator equals true in query
  • Loading branch information
levisingularity authored Feb 9, 2024
1 parent 9a9c9d4 commit e96a5f7
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 18 deletions.
2 changes: 1 addition & 1 deletion das-query-engine/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def get_incoming_links(
def query(
self,
query: Dict[str, Any],
parameters: Dict[str, Any] | None = None,
parameters: Dict[str, Any] = {"no_iterator": True},
) -> List[Dict[str, Any]]:
return self.distributed_atom_space.query(query, parameters)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def expected_output(self):
"composite_type_hash": "d99a604c79ce3c2e76a2f43488d5d4c3",
"name": self.terminal_name,
"named_type": self.named_type,
"type": self.named_type,
}

def test_get_atom_action(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,22 @@ def expected_output(self):
"af12f10f9ae2002a1607ba0b47ba8407",
"4e8e26e3276af8a5c2ac2cc2dc95c6d2",
],
"type": "Similarity",
},
[
{
"handle": "af12f10f9ae2002a1607ba0b47ba8407",
"composite_type_hash": "d99a604c79ce3c2e76a2f43488d5d4c3",
"name": "human",
"named_type": "Concept",
"type": "Concept",
},
{
"handle": "4e8e26e3276af8a5c2ac2cc2dc95c6d2",
"composite_type_hash": "d99a604c79ce3c2e76a2f43488d5d4c3",
"name": "ent",
"named_type": "Concept",
"type": "Concept",
},
],
],
Expand All @@ -73,19 +76,22 @@ def expected_output(self):
"4e8e26e3276af8a5c2ac2cc2dc95c6d2",
"af12f10f9ae2002a1607ba0b47ba8407",
],
"type": "Similarity",
},
[
{
"handle": "4e8e26e3276af8a5c2ac2cc2dc95c6d2",
"composite_type_hash": "d99a604c79ce3c2e76a2f43488d5d4c3",
"name": "ent",
"named_type": "Concept",
"type": "Concept",
},
{
"handle": "af12f10f9ae2002a1607ba0b47ba8407",
"composite_type_hash": "d99a604c79ce3c2e76a2f43488d5d4c3",
"name": "human",
"named_type": "Concept",
"type": "Concept",
},
],
],
Expand All @@ -105,19 +111,22 @@ def expected_output(self):
"5b34c54bee150c04f9fa584b899dc030",
"af12f10f9ae2002a1607ba0b47ba8407",
],
"type": "Similarity",
},
[
{
"handle": "5b34c54bee150c04f9fa584b899dc030",
"composite_type_hash": "d99a604c79ce3c2e76a2f43488d5d4c3",
"name": "chimp",
"named_type": "Concept",
"type": "Concept",
},
{
"handle": "af12f10f9ae2002a1607ba0b47ba8407",
"composite_type_hash": "d99a604c79ce3c2e76a2f43488d5d4c3",
"name": "human",
"named_type": "Concept",
"type": "Concept",
},
],
],
Expand All @@ -137,19 +146,22 @@ def expected_output(self):
"af12f10f9ae2002a1607ba0b47ba8407",
"5b34c54bee150c04f9fa584b899dc030",
],
"type": "Similarity",
},
[
{
"handle": "af12f10f9ae2002a1607ba0b47ba8407",
"composite_type_hash": "d99a604c79ce3c2e76a2f43488d5d4c3",
"name": "human",
"named_type": "Concept",
"type": "Concept",
},
{
"handle": "5b34c54bee150c04f9fa584b899dc030",
"composite_type_hash": "d99a604c79ce3c2e76a2f43488d5d4c3",
"name": "chimp",
"named_type": "Concept",
"type": "Concept",
},
],
],
Expand All @@ -169,19 +181,22 @@ def expected_output(self):
"af12f10f9ae2002a1607ba0b47ba8407",
"bdfe4e7a431f73386f37c6448afe5840",
],
"type": "Inheritance",
},
[
{
"handle": "af12f10f9ae2002a1607ba0b47ba8407",
"composite_type_hash": "d99a604c79ce3c2e76a2f43488d5d4c3",
"name": "human",
"named_type": "Concept",
"type": "Concept",
},
{
"handle": "bdfe4e7a431f73386f37c6448afe5840",
"composite_type_hash": "d99a604c79ce3c2e76a2f43488d5d4c3",
"name": "mammal",
"named_type": "Concept",
"type": "Concept",
},
],
],
Expand All @@ -201,19 +216,22 @@ def expected_output(self):
"1cdffc6b0b89ff41d68bec237481d1e1",
"af12f10f9ae2002a1607ba0b47ba8407",
],
"type": "Similarity",
},
[
{
"handle": "1cdffc6b0b89ff41d68bec237481d1e1",
"composite_type_hash": "d99a604c79ce3c2e76a2f43488d5d4c3",
"name": "monkey",
"named_type": "Concept",
"type": "Concept",
},
{
"handle": "af12f10f9ae2002a1607ba0b47ba8407",
"composite_type_hash": "d99a604c79ce3c2e76a2f43488d5d4c3",
"name": "human",
"named_type": "Concept",
"type": "Concept",
},
],
],
Expand All @@ -233,19 +251,22 @@ def expected_output(self):
"af12f10f9ae2002a1607ba0b47ba8407",
"1cdffc6b0b89ff41d68bec237481d1e1",
],
"type": "Similarity",
},
[
{
"handle": "af12f10f9ae2002a1607ba0b47ba8407",
"composite_type_hash": "d99a604c79ce3c2e76a2f43488d5d4c3",
"name": "human",
"named_type": "Concept",
"type": "Concept",
},
{
"handle": "1cdffc6b0b89ff41d68bec237481d1e1",
"composite_type_hash": "d99a604c79ce3c2e76a2f43488d5d4c3",
"name": "monkey",
"named_type": "Concept",
"type": "Concept",
},
],
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def expected_output(self):
"af12f10f9ae2002a1607ba0b47ba8407",
"1cdffc6b0b89ff41d68bec237481d1e1",
],
"type": "Similarity",
}

def test_get_link_action(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def expected_output(self):
"composite_type_hash": "d99a604c79ce3c2e76a2f43488d5d4c3",
"name": "human",
"named_type": "Concept",
"type": "Concept",
}

def test_get_node_action(
Expand Down
38 changes: 21 additions & 17 deletions das-query-engine/tests/integration/handle/test_query_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,34 @@ def valid_event(self, action_type):
{"atom_type": "node", "type": "Concept", "name": "human"},
{"atom_type": "node", "type": "Concept", "name": "monkey"},
],
}
},
"parameters": {"no_iterator": True},
},
}
}

@pytest.fixture
def expected_output(self):
return [
{
"handle": "bad7472f41a0e7d601ca294eb4607c3a",
"type": "Similarity",
"targets": [
{
"handle": "af12f10f9ae2002a1607ba0b47ba8407",
"type": "Concept",
"name": "human",
},
{
"handle": "1cdffc6b0b89ff41d68bec237481d1e1",
"type": "Concept",
"name": "monkey",
},
],
}
[
None,
{
"handle": "bad7472f41a0e7d601ca294eb4607c3a",
"type": "Similarity",
"targets": [
{
"handle": "af12f10f9ae2002a1607ba0b47ba8407",
"type": "Concept",
"name": "human",
},
{
"handle": "1cdffc6b0b89ff41d68bec237481d1e1",
"type": "Concept",
"name": "monkey",
},
],
},
]
]

def test_query_action(
Expand Down

0 comments on commit e96a5f7

Please sign in to comment.