-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #342 from singnet/senna-db-216-1
[das-atom-db#216] Removed cursor from api of get_matched*() and get_incoming_links()
- Loading branch information
Showing
15 changed files
with
163 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
[#338] Change get_links() API to use link filters instead of optional parameters | ||
[das-atom-db#216] Removed cursor from api of get_matched*() and get_incoming_links() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
#remote_das_host = "localhost" | ||
remote_das_host = "45.63.85.59" | ||
remote_das_port = 8080 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import pytest | ||
|
||
from hyperon_das import DistributedAtomSpace | ||
|
||
from .helpers import ( | ||
MettaAnimalBaseHandlesCollection, | ||
_db_down, | ||
_db_up, | ||
cleanup, | ||
load_metta_animals_base, | ||
mongo_port, | ||
redis_port, | ||
) | ||
from .remote_das_info import remote_das_host, remote_das_port | ||
|
||
das_instance = {} | ||
|
||
|
||
class TestDASQueryAPI: | ||
"""Test query methods in DAS API with integration of DAS and its various AtomDB adapters""" | ||
|
||
@classmethod | ||
def setup_class(cls): | ||
_db_up() | ||
|
||
das_instance["local_ram"] = DistributedAtomSpace(query_engine='local', atomdb='ram') | ||
load_metta_animals_base(das_instance["local_ram"]) | ||
|
||
das_instance["local_redis_mongo"] = DistributedAtomSpace( | ||
query_engine='local', | ||
atomdb='redis_mongo', | ||
mongo_port=mongo_port, | ||
mongo_username='dbadmin', | ||
mongo_password='dassecret', | ||
redis_port=redis_port, | ||
redis_cluster=False, | ||
redis_ssl=False, | ||
) | ||
load_metta_animals_base(das_instance["local_redis_mongo"]) | ||
das_instance["local_redis_mongo"].commit_changes() | ||
|
||
das_instance["remote"] = DistributedAtomSpace( | ||
query_engine='remote', host=remote_das_host, port=remote_das_port | ||
) | ||
|
||
@classmethod | ||
def teardown_class(cls): | ||
_db_down() | ||
|
||
@pytest.fixture(scope="session", autouse=True) | ||
def _cleanup(self, request): | ||
return cleanup(request) | ||
|
||
def test_count_atoms(self): | ||
for key, das in das_instance.items(): | ||
count = das.count_atoms({}) | ||
assert count["atom_count"] == 66 | ||
|
||
def test_get_atom(self): | ||
for key, das in das_instance.items(): | ||
node_list = [] | ||
for handle in MettaAnimalBaseHandlesCollection.node_handles: | ||
atom = das.get_atom(handle) | ||
assert atom["handle"] == handle | ||
node_list.append(atom) | ||
link_list = [] | ||
for handle in MettaAnimalBaseHandlesCollection.link_handles: | ||
atom = das.get_atom(handle) | ||
assert atom["handle"] == handle | ||
link_list.append(atom) | ||
if key != "remote": | ||
assert node_list == das.get_atoms(MettaAnimalBaseHandlesCollection.node_handles) | ||
assert link_list == das.get_atoms(MettaAnimalBaseHandlesCollection.link_handles) |
Oops, something went wrong.