From 6431afa7e5352824e5bf0b5c0bfebea2817ee5f9 Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Mon, 5 Aug 2024 21:11:12 -0700 Subject: [PATCH] update tests --- nwb_linkml/src/nwb_linkml/adapters/dataset.py | 18 ++++++++++++++---- .../test_adapters/test_adapter_classes.py | 13 +++++++------ 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/nwb_linkml/src/nwb_linkml/adapters/dataset.py b/nwb_linkml/src/nwb_linkml/adapters/dataset.py index 824fe84..3a49798 100644 --- a/nwb_linkml/src/nwb_linkml/adapters/dataset.py +++ b/nwb_linkml/src/nwb_linkml/adapters/dataset.py @@ -154,10 +154,14 @@ class MapScalarAttributes(DatasetMap): name: rate description: Sampling rate, in Hz. range: float32 + required: true unit: name: unit description: Unit of measurement for time, which is fixed to 'seconds'. + ifabsent: string(seconds) range: text + required: true + equals_string: seconds value: name: value range: float64 @@ -244,11 +248,15 @@ class MapListlike(DatasetMap): range: string required: true value: - name: image + name: value + annotations: + source_type: + tag: source_type + value: reference description: Ordered dataset of references to Image objects. - multivalued: true range: Image required: true + multivalued: true tree_root: true """ @@ -476,12 +484,14 @@ class MapArrayLikeAttributes(DatasetMap): name: resolution description: Pixel resolution of the image, in pixels per centimeter. range: float32 + required: false description: name: description description: Description of the image. range: text - array: - name: array + required: false + value: + name: value range: numeric any_of: - array: diff --git a/nwb_linkml/tests/test_adapters/test_adapter_classes.py b/nwb_linkml/tests/test_adapters/test_adapter_classes.py index 464e55f..126869e 100644 --- a/nwb_linkml/tests/test_adapters/test_adapter_classes.py +++ b/nwb_linkml/tests/test_adapters/test_adapter_classes.py @@ -3,6 +3,7 @@ from linkml_runtime.linkml_model import SlotDefinition from nwb_linkml.adapters import DatasetAdapter, GroupAdapter from nwb_schema_language import CompoundDtype, Dataset, Group, ReferenceDtype +from nwb_linkml.maps.dtype import handle_dtype @pytest.mark.xfail() @@ -89,7 +90,7 @@ def test_get_full_name(): parent.cls.neurodata_type_def = None parent.cls.name = "ParentName" parent.parent = grandparent - assert adapter._get_full_name() == "Grandparent__ParentName__ChildName" + assert adapter._get_full_name() == "ParentName__ChildName" # if it has none, raise value error adapter.cls.name = None @@ -179,9 +180,9 @@ def test_handle_dtype(nwb_schema): CompoundDtype(name="reference", doc="reference!", dtype=reftype), ] - assert cls.handle_dtype(reftype) == "TargetClass" - assert cls.handle_dtype(None) == "AnyType" - assert cls.handle_dtype([]) == "AnyType" + assert handle_dtype(reftype) == "TargetClass" + assert handle_dtype(None) == "AnyType" + assert handle_dtype([]) == "AnyType" # handling compound types is currently TODO - assert cls.handle_dtype(compoundtype) == "AnyType" - assert cls.handle_dtype("int32") == "int32" + assert handle_dtype(compoundtype) == "AnyType" + assert handle_dtype("int32") == "int32"