Skip to content

Commit 2046eb8

Browse files
authored
Enhance pynwb validation parsing, fix pynwb typo
1 parent 61e28e0 commit 2046eb8

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

dandi/pynwb_utils.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -360,18 +360,19 @@ def validate(path: str | Path, devel_debug: bool = False) -> list[ValidationResu
360360
else: # Fallback if an older version
361361
with pynwb.NWBHDF5IO(path=path, mode="r", load_namespaces=True) as reader:
362362
error_outputs = pynwb.validate(io=reader)
363-
for error_output in error_outputs:
363+
for error in error_outputs:
364364
errors.append(
365365
ValidationResult(
366366
origin=ValidationOrigin(
367367
name="pynwb",
368368
version=pynwb.__version__,
369369
),
370-
severity=Severity.WARNING,
371-
id=f"pywnb.{error_output}",
370+
severity=Severity.ERROR,
371+
id=f"pynwb.{error}",
372372
scope=Scope.FILE,
373373
path=Path(path),
374-
message="Failed to validate.",
374+
message=f"Failed to validate. {error.reason}",
375+
within_asset_paths={path: error.location},
375376
)
376377
)
377378
except Exception as exc:
@@ -384,7 +385,7 @@ def validate(path: str | Path, devel_debug: bool = False) -> list[ValidationResu
384385
version=pynwb.__version__,
385386
),
386387
severity=Severity.ERROR,
387-
id="pywnb.GENERIC",
388+
id="pynwb.GENERIC",
388389
scope=Scope.FILE,
389390
path=Path(path),
390391
message=f"{exc}",
@@ -416,7 +417,7 @@ def validate(path: str | Path, devel_debug: bool = False) -> list[ValidationResu
416417
version=pynwb.__version__,
417418
),
418419
severity=Severity.ERROR,
419-
id="pywnb.GENERIC",
420+
id="pynwb.GENERIC",
420421
scope=Scope.FILE,
421422
path=Path(path),
422423
message=e,

dandi/tests/fixtures.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def simple4_nwb(tmp_path_factory: pytest.TempPathFactory) -> Path:
165165
def simple5_nwb(tmp_path_factory: pytest.TempPathFactory) -> Path:
166166
"""
167167
With subject, subject_id, species, but including data orientation ambiguity, and missing
168-
the `pywnb.Timeseries` `unit` attribute.
168+
the `pynwb.Timeseries` `unit` attribute.
169169
170170
Notes
171171
-----

0 commit comments

Comments
 (0)