-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d6bf764
commit 025442b
Showing
4 changed files
with
59 additions
and
72 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
This file was deleted.
Oops, something went wrong.
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,49 @@ | ||
import pytest | ||
import aerovaldb | ||
|
||
def test_get_glob_stats(): | ||
with aerovaldb.open(f"json_files:./tests/test-db/json") as db: | ||
data = db.get_glob_stats( | ||
"project", "experiment", "frequency", access_type="OBJ" | ||
) | ||
assert data["path"] == "./project/experiment/hm/" | ||
|
||
def test_put_glob_stats(): | ||
# TODO: These tests should ideally cleanup after themselves. For now | ||
# it is best to delete ./tests/test-db/tmp before running to verify | ||
# that they run as intended. | ||
with aerovaldb.open("json_files:./tests/test-db/tmp") as db: | ||
obj = {"data": "gibberish"} | ||
db.put_glob_stats(obj, "test1", "test2", "test3") | ||
read_data = db.get_glob_stats("test1", "test2", "test3") | ||
|
||
assert obj["data"] == read_data["data"] | ||
|
||
def test_get_contour(): | ||
with aerovaldb.open(f"json_files:./tests/test-db/json") as db: | ||
data = db.get_contour("project", "experiment") | ||
assert data["path"] == "./project/experiment/contour/" | ||
|
||
def test_put_contour(): | ||
with aerovaldb.open("json_files:./tests/test-db/tmp") as db: | ||
obj = {"data": "gibberish"} | ||
db.put_contour(obj, "test1", "test2") | ||
read_data = db.get_contour("test1", "test2") | ||
assert obj["data"] == read_data["data"] | ||
|
||
def test_get_ts(): | ||
with aerovaldb.open(f"json_files:./tests/test-db/json") as db: | ||
data = db.get_ts( | ||
"project", "experiment", "region", "network", "obsvar", "layer" | ||
) | ||
|
||
assert data["path"] == "./project/experiment/ts/" | ||
|
||
def test_put_ts(): | ||
with aerovaldb.open("json_files:./tests/test-db/tmp") as db: | ||
obj = {"data": "gibberish"} | ||
db.put_ts(obj, "test1", "test2", "test3", "test4", "test5", "test6") | ||
|
||
read_data = db.get_ts("test1", "test2", "test3", "test4", "test5", "test6") | ||
|
||
assert obj["data"] == read_data["data"] |
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,7 @@ | ||
import pytest | ||
import aerovaldb | ||
|
||
def test_plugins(): | ||
engines = aerovaldb.list_engines() | ||
print(engines) | ||
assert len(engines) >= 1 |