Skip to content

Commit 0115dc1

Browse files
fix: move resolution into inline spec and remove subtype lookup
1 parent 7f91df6 commit 0115dc1

2 files changed

Lines changed: 13 additions & 29 deletions

File tree

src/hdmf/validate/validator.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -498,21 +498,6 @@ def validate(self, **kwargs):
498498
except Exception:
499499
pass
500500

501-
if not found and dt is not None:
502-
try:
503-
for candidate_dt, v in self.vmap._ValidatorMap__validators.items():
504-
if candidate_dt == dt:
505-
continue
506-
if hasattr(v, "_BaseStorageValidator__attribute_validators"):
507-
candidate_hierarchy = self.vmap.namespace.get_hierarchy(candidate_dt)
508-
if dt in candidate_hierarchy:
509-
dt_attrs = set(v._BaseStorageValidator__attribute_validators.keys())
510-
if builder_attr in dt_attrs:
511-
found = True
512-
break
513-
except Exception:
514-
pass
515-
516501
if not found:
517502
ret.append(ExtraFieldWarning(
518503
self.get_spec_loc(self.spec),

tests/unit/validator_tests/test_validate.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2064,21 +2064,20 @@ def getSpecs(self):
20642064
AttributeSpec(name='resolution', dtype='float', doc='extra attribute')
20652065
]
20662066
)
2067-
return (
2068-
base_spec,
2069-
ext_spec,
2070-
GroupSpec(
2071-
doc='A group containing the base type',
2072-
data_type_def='GroupWithBase',
2073-
datasets=[
2074-
DatasetSpec(
2075-
name='data_column',
2076-
doc='a dataset of base type',
2077-
data_type_inc='BaseType'
2078-
)
2079-
]
2080-
),
2067+
group_dataset_spec = DatasetSpec(
2068+
name='data_column',
2069+
doc='a dataset of base type',
2070+
data_type_inc='BaseType',
2071+
attributes=[
2072+
AttributeSpec(name='resolution', dtype='float', doc='extra attribute')
2073+
]
2074+
)
2075+
group_spec = GroupSpec(
2076+
doc='A group containing the base type',
2077+
data_type_def='GroupWithBase',
2078+
datasets=[group_dataset_spec]
20812079
)
2080+
return (base_spec, ext_spec, group_spec)
20822081

20832082
def test_attribute_intersection_no_warning(self):
20842083
"""Test that 'resolution' triggers NO warning because ext_spec knows it."""

0 commit comments

Comments
 (0)