update tests

This commit is contained in:
sneakers-the-rat 2024-08-05 21:11:12 -07:00
parent 83dd59d30d
commit 6431afa7e5
Signed by untrusted user who does not match committer: jonny
GPG key ID: 6DCB96EF1E4D232D
2 changed files with 21 additions and 10 deletions

View file

@ -154,10 +154,14 @@ class MapScalarAttributes(DatasetMap):
name: rate name: rate
description: Sampling rate, in Hz. description: Sampling rate, in Hz.
range: float32 range: float32
required: true
unit: unit:
name: unit name: unit
description: Unit of measurement for time, which is fixed to 'seconds'. description: Unit of measurement for time, which is fixed to 'seconds'.
ifabsent: string(seconds)
range: text range: text
required: true
equals_string: seconds
value: value:
name: value name: value
range: float64 range: float64
@ -244,11 +248,15 @@ class MapListlike(DatasetMap):
range: string range: string
required: true required: true
value: value:
name: image name: value
annotations:
source_type:
tag: source_type
value: reference
description: Ordered dataset of references to Image objects. description: Ordered dataset of references to Image objects.
multivalued: true
range: Image range: Image
required: true required: true
multivalued: true
tree_root: true tree_root: true
""" """
@ -476,12 +484,14 @@ class MapArrayLikeAttributes(DatasetMap):
name: resolution name: resolution
description: Pixel resolution of the image, in pixels per centimeter. description: Pixel resolution of the image, in pixels per centimeter.
range: float32 range: float32
required: false
description: description:
name: description name: description
description: Description of the image. description: Description of the image.
range: text range: text
array: required: false
name: array value:
name: value
range: numeric range: numeric
any_of: any_of:
- array: - array:

View file

@ -3,6 +3,7 @@ from linkml_runtime.linkml_model import SlotDefinition
from nwb_linkml.adapters import DatasetAdapter, GroupAdapter from nwb_linkml.adapters import DatasetAdapter, GroupAdapter
from nwb_schema_language import CompoundDtype, Dataset, Group, ReferenceDtype from nwb_schema_language import CompoundDtype, Dataset, Group, ReferenceDtype
from nwb_linkml.maps.dtype import handle_dtype
@pytest.mark.xfail() @pytest.mark.xfail()
@ -89,7 +90,7 @@ def test_get_full_name():
parent.cls.neurodata_type_def = None parent.cls.neurodata_type_def = None
parent.cls.name = "ParentName" parent.cls.name = "ParentName"
parent.parent = grandparent 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 # if it has none, raise value error
adapter.cls.name = None adapter.cls.name = None
@ -179,9 +180,9 @@ def test_handle_dtype(nwb_schema):
CompoundDtype(name="reference", doc="reference!", dtype=reftype), CompoundDtype(name="reference", doc="reference!", dtype=reftype),
] ]
assert cls.handle_dtype(reftype) == "TargetClass" assert handle_dtype(reftype) == "TargetClass"
assert cls.handle_dtype(None) == "AnyType" assert handle_dtype(None) == "AnyType"
assert cls.handle_dtype([]) == "AnyType" assert handle_dtype([]) == "AnyType"
# handling compound types is currently TODO # handling compound types is currently TODO
assert cls.handle_dtype(compoundtype) == "AnyType" assert handle_dtype(compoundtype) == "AnyType"
assert cls.handle_dtype("int32") == "int32" assert handle_dtype("int32") == "int32"