Skip to content

Commit

Permalink
partial adjustments in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
marcocapozzoli committed Dec 12, 2023
1 parent ae06028 commit e9f9eb1
Showing 1 changed file with 6 additions and 52 deletions.
58 changes: 6 additions & 52 deletions tests/integration/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from hyperon_das.client import FunctionsClient
from hyperon_das.constants import QueryOutputFormat

# TODO: This tests needs adjustments when functions remain online


class TestAWSClientIntegration:
@pytest.fixture()
Expand Down Expand Up @@ -132,28 +134,12 @@ def server(self):

def test_get_node(self, server: FunctionsClient):
human_handle = ExpressionHasher.terminal_hash('Concept', 'human')
ret = server.get_node(
node_type="Concept",
node_name="human",
output_format=QueryOutputFormat.HANDLE,
)
assert ret == human_handle
ret = server.get_node(
node_type="Concept",
node_name="human",
output_format=QueryOutputFormat.ATOM_INFO,
)
ret = server.get_node(node_type="Concept", node_name="human")
assert ret == {
'handle': human_handle,
'type': 'Concept',
'name_type': 'Concept',
'name': 'human',
}
ret = server.get_node(
node_type="Concept",
node_name="human",
output_format=QueryOutputFormat.JSON,
)
assert ret == {'type': 'Concept', 'name': 'human'}

def test_get_link(self, server: FunctionsClient):
human_handle = ExpressionHasher.terminal_hash('Concept', 'human')
Expand All @@ -167,30 +153,12 @@ def test_get_link(self, server: FunctionsClient):
targets=[human_handle, monkey_handle],
output_format=QueryOutputFormat.HANDLE,
)
assert ret == link_handle
ret = server.get_link(
link_type='Similarity',
targets=[human_handle, monkey_handle],
output_format=QueryOutputFormat.ATOM_INFO,
)
assert ret == {
'handle': link_handle,
'type': 'Similarity',
'template': ['Similarity', 'Concept', 'Concept'],
'targets': [human_handle, monkey_handle],
}
ret = server.get_link(
link_type='Similarity',
targets=[human_handle, monkey_handle],
output_format=QueryOutputFormat.JSON,
)
assert ret == {
'type': 'Similarity',
'targets': [
{'type': 'Concept', 'name': 'human'},
{'type': 'Concept', 'name': 'monkey'},
],
}

def test_get_links(self, server: FunctionsClient):
human_handle = ExpressionHasher.terminal_hash('Concept', 'human')
Expand All @@ -213,33 +181,19 @@ def test_get_atom(self, server: FunctionsClient):
ExpressionHasher.named_type_hash('Similarity'),
[human_handle, monkey_handle],
)
ret = server.get_atom(handle=monkey_handle, output_format=QueryOutputFormat.HANDLE)
assert ret == monkey_handle
ret = server.get_atom(handle=monkey_handle, output_format=QueryOutputFormat.ATOM_INFO)
ret = server.get_atom(handle=monkey_handle)
assert ret == {
'handle': monkey_handle,
'type': 'Concept',
'name': 'monkey',
}
ret = server.get_atom(handle=monkey_handle, output_format=QueryOutputFormat.JSON)
assert ret == {'type': 'Concept', 'name': 'monkey'}
ret = server.get_atom(handle=link_handle, output_format=QueryOutputFormat.HANDLE)
assert ret == link_handle
ret = server.get_atom(handle=link_handle, output_format=QueryOutputFormat.ATOM_INFO)
ret = server.get_atom(handle=link_handle)
assert ret == {
'handle': link_handle,
'type': 'Similarity',
'template': ['Similarity', 'Concept', 'Concept'],
'targets': [human_handle, monkey_handle],
}
ret = server.get_atom(handle=link_handle, output_format=QueryOutputFormat.JSON)
assert ret == {
'type': 'Similarity',
'targets': [
{'type': 'Concept', 'name': 'human'},
{'type': 'Concept', 'name': 'monkey'},
],
}

def test_count_atoms(self, server: FunctionsClient):
ret = server.count_atoms()
Expand Down

0 comments on commit e9f9eb1

Please sign in to comment.