Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix validator not validating on spec of builder data type #1050

Merged
merged 3 commits into from
Feb 5, 2024

Conversation

rly
Copy link
Contributor

@rly rly commented Jan 31, 2024

Motivation

Fix #1049

How to test the behavior?

pytest

Checklist

  • Did you update CHANGELOG.md with your changes?
  • Does the PR clearly describe the problem and the solution?
  • Have you reviewed our Contributing Guide?
  • Does the PR use "Fix #XXX" notation to tell GitHub to close the relevant issue numbered XXX when the PR is merged?

@rly rly requested a review from bendichter January 31, 2024 21:30
@rly rly requested a review from oruebel January 31, 2024 21:31
Copy link

codecov bot commented Jan 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (3fbe27d) 88.53% compared to head (78f51dd) 88.53%.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #1050   +/-   ##
=======================================
  Coverage   88.53%   88.53%           
=======================================
  Files          45       45           
  Lines        9599     9603    +4     
  Branches     2730     2731    +1     
=======================================
+ Hits         8498     8502    +4     
  Misses        778      778           
  Partials      323      323           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rly
Copy link
Contributor Author

rly commented Jan 31, 2024

Tests in pynwb dev need to be updated before merging.

@rly
Copy link
Contributor Author

rly commented Feb 5, 2024

Note that releasing this has a significant potential to cause issues in existing pipelines because validation will raise more errors than it did before (and it should raise those errors because the files are non-compliant). So NWB files and dandisets that previously passed pynwb validation might now fail.

@bendichter
Copy link
Contributor

I can confirm that this works now using this branch from hdmf:

import h5py
from pynwb.testing.mock.ecephys import mock_ElectricalSeries

from pynwb import NWBHDF5IO, NWBFile
from datetime import datetime
from dateutil.tz import tzlocal

nwbfile = NWBFile(
    session_description="my first synthetic recording",
    identifier="EXAMPLE_ID",
    session_start_time=datetime.now(tzlocal()),
    session_id="LONELYMTN",
)

mock_ElectricalSeries(nwbfile=nwbfile)

with NWBHDF5IO("test_electrodes.nwb", "w") as io:
    io.write(nwbfile)

with h5py.File("test_electrodes.nwb", "r+") as f:
    del f["acquisition"]["ElectricalSeries"]["electrodes"]
python -m pynwb.validate test_electrodes.nwb
Validating /test_electrodes.nwb against cached namespace information using namespace 'core'.
 - found the following errors:
ElectricalSeries (acquisition/ElectricalSeries): missing data type DynamicTableRegion (electrodes)

@rly rly merged commit 46d81cb into dev Feb 5, 2024
28 checks passed
@rly rly deleted the fix_validator_subspec branch February 5, 2024 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Invalid object passing validation
2 participants