hdmf
hdmf copied to clipboard
[Bug]: Shape should be validated on write
What happened?
keywords is a 1D dataset of NWBFile. NWBFile does not validate the shape of some array arguments in __init__. In cases like this where shape validation is not happening in init/docval, it should be validated on write/build.
Related: https://github.com/NeurodataWithoutBorders/pynwb/issues/1288
Steps to Reproduce
import pynwb
from pynwb.testing.mock.file import mock_NWBFile
with pynwb.NWBHDF5IO("test.nwb", "w") as io:
io.write(mock_NWBFile(keywords=[["aa", "bb"]]))
pynwb.validate(paths=["test.nwb"])
Output:
([root/general/keywords (general/keywords): incorrect shape - expected '[None]', got '(1, 2)'], 0)
Traceback
No response
Operating System
macOS
Python Executable
Conda
Python Version
3.12
Package Versions
No response