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

[Bug]: Shape should be validated on write #1190

Open
rly opened this issue Sep 5, 2024 · 0 comments
Open

[Bug]: Shape should be validated on write #1190

rly opened this issue Sep 5, 2024 · 0 comments
Assignees
Labels
category: bug errors in the code or code behavior priority: medium non-critical problem and/or affecting only a small set of users
Milestone

Comments

@rly
Copy link
Contributor

rly commented Sep 5, 2024

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: NeurodataWithoutBorders/pynwb#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

@rly rly added category: bug errors in the code or code behavior priority: medium non-critical problem and/or affecting only a small set of users labels Sep 5, 2024
@rly rly added this to the Future milestone Sep 5, 2024
@mavaylon1 mavaylon1 self-assigned this Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: bug errors in the code or code behavior priority: medium non-critical problem and/or affecting only a small set of users
Projects
None yet
Development

No branches or pull requests

2 participants