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

Validator does not promote integer types across signedness #470

Open
t-b opened this issue Nov 21, 2020 · 0 comments
Open

Validator does not promote integer types across signedness #470

t-b opened this issue Nov 21, 2020 · 0 comments
Labels
category: bug errors in the code or code behavior topic: validator issues related to validation of files

Comments

@t-b
Copy link
Contributor

t-b commented Nov 21, 2020

Related to NeurodataWithoutBorders/pynwb#1321 and https://dandiarchive.slack.com/archives/C011LRNU2F7/p1605978955012100?thread_ts=1605798117.007200&cid=C011LRNU2F7.

The file
HardwareTests-V2-MIES-187d9143.zip validates against the cached spec (2.2.4 core and 1.1.3 hdmf). But fails against the stock schemas of pynwb 1.4.0.

$ python -m pynwb.validate --no-cached-namespace HardwareTests-V2-MIES-187d9143.nwb
Validating HardwareTests-V2-MIES-187d9143.nwb against pynwb namespace information using namespace core.
 - found the following errors:
VectorIndex/description (general/intracellular_ephys/sweep_table/series_index): argument missing
VectorIndex (general/intracellular_ephys/sweep_table/series_index): incorrect type - expected 'uint8', got 'int32'
VectorIndex/description (general/intracellular_ephys/sweep_table/series_index): argument missing
VectorIndex (general/intracellular_ephys/sweep_table/series_index): incorrect type - expected 'uint8', got 'int32'
(base)
thomas@Win10-Thomas-PC MSYS /e/projekte/mies-igor/tools/unit-testing (feature/add-subject-info)
$ python -m pynwb.validate --cached-namespace HardwareTests-V2-MIES-187d9143.nwb
Validating HardwareTests-V2-MIES-187d9143.nwb against cached namespace information using namespace ndx-mies.
 - no errors found.
(base)

The validation error is incorrect as every uint8 can be represented as int32.

Edit: It might be enough to throw a couple of new values into

__additional = {
'float': ['double'],
'int8': ['short', 'int', 'long'],
'short': ['int', 'long'],
'int': ['long'],
'uint8': ['uint16', 'uint32', 'uint64'],
'uint16': ['uint32', 'uint64'],
'uint32': ['uint64'],
'utf': ['ascii']
}
# if the spec dtype is a key in __allowable, then all types in __allowable[key] are valid
__allowable = dict()
for dt, dt_syn in __synonyms.items():
allow = copy(dt_syn)
if dt in __additional:
for addl in __additional[dt]:
allow.extend(__synonyms[addl])
for syn in dt_syn:
__allowable[syn] = allow
.

@t-b t-b added the category: bug errors in the code or code behavior label Nov 21, 2020
@rly rly added the topic: validator issues related to validation of files label Nov 25, 2020
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 topic: validator issues related to validation of files
Projects
None yet
Development

No branches or pull requests

2 participants