2024-07-09 07:27:22 +00:00
|
|
|
import pytest
|
2024-07-04 03:39:49 +00:00
|
|
|
|
2024-07-09 10:32:37 +00:00
|
|
|
from nwb_linkml.adapters.dataset import MapScalar
|
2024-07-02 04:44:35 +00:00
|
|
|
from nwb_schema_language import Dataset
|
2023-10-20 04:20:50 +00:00
|
|
|
|
2023-10-10 01:59:53 +00:00
|
|
|
|
|
|
|
def test_nothing(nwb_core_fixture):
|
2023-10-20 04:20:50 +00:00
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
def _compare_dicts(dict1, dict2) -> bool:
|
|
|
|
"""just in one direction - that all the entries in dict1 are in dict2"""
|
2024-07-02 06:05:47 +00:00
|
|
|
assert all([dict1[k] == dict2[k] for k in dict1])
|
2024-07-02 04:23:31 +00:00
|
|
|
# assert all([dict1[k] == dict2[k] for k in dict2.keys()])
|
|
|
|
|
2023-10-20 04:20:50 +00:00
|
|
|
|
2024-07-09 07:27:22 +00:00
|
|
|
@pytest.mark.xfail()
|
2023-10-20 04:20:50 +00:00
|
|
|
def test_map_scalar():
|
|
|
|
|
2024-07-02 04:23:31 +00:00
|
|
|
model = {
|
|
|
|
"name": "MyScalar",
|
|
|
|
"doc": "This should be a scalar",
|
|
|
|
"dtype": "int32",
|
|
|
|
"quantity": "?",
|
|
|
|
}
|
|
|
|
test = {
|
|
|
|
"name": "MyScalar",
|
|
|
|
"description": "This should be a scalar",
|
|
|
|
"multivalued": False,
|
|
|
|
"range": "int32",
|
|
|
|
"required": False,
|
|
|
|
}
|
|
|
|
|
|
|
|
dataset = Dataset(**model)
|
|
|
|
assert MapScalar.check(dataset)
|
|
|
|
result = MapScalar.apply(dataset)
|
|
|
|
assert len(result.classes) == 0
|
|
|
|
_compare_dicts(test, result.slots[0])
|
2023-10-20 04:20:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_map_scalar_attributes():
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
def test_map_listlike():
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
def test_map_arraylike():
|
|
|
|
pass
|
|
|
|
|
2024-07-02 04:23:31 +00:00
|
|
|
|
2023-10-20 04:20:50 +00:00
|
|
|
def test_map_arraylike_attributes():
|
|
|
|
pass
|
|
|
|
|
2024-07-02 04:23:31 +00:00
|
|
|
|
2023-10-20 04:20:50 +00:00
|
|
|
def test_map_1d_vector():
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
def test_map_n_vectors():
|
2024-07-02 04:23:31 +00:00
|
|
|
pass
|