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

in validation, add check for if a varlen datasets is empty #789

Merged
merged 15 commits into from
Jan 13, 2024

Conversation

bendichter
Copy link
Contributor

Motivation

fix #788

@oruebel here's my attempt

@codecov
Copy link

codecov bot commented Nov 10, 2022

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (216aa34) 88.46% compared to head (337162a) 88.50%.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #789      +/-   ##
==========================================
+ Coverage   88.46%   88.50%   +0.04%     
==========================================
  Files          45       45              
  Lines        9579     9582       +3     
  Branches     2723     2724       +1     
==========================================
+ Hits         8474     8481       +7     
+ Misses        781      778       -3     
+ Partials      324      323       -1     

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

@oruebel
Copy link
Contributor

oruebel commented Nov 10, 2022

I think this fix looks appropriate. Now we need a test.

@oruebel
Copy link
Contributor

oruebel commented Nov 10, 2022

Ok, I have a test that will trigger the issue. I'll just add it to this PR.

@oruebel oruebel added category: bug errors in the code or code behavior topic: validator issues related to validation of files labels Nov 10, 2022
@oruebel oruebel requested a review from rly November 11, 2022 00:15
@oruebel
Copy link
Contributor

oruebel commented Nov 11, 2022

@rly can you please review this PR. I made a bunch of changes on the PR so I should not be the approver.

The main change is the following line, to make sure the validator works if we encounter an empty dataset of strings (e.g, an empty keywords dataset in NWB)

# Empty string array
if data.dtype.metadata["vlen"] == str:
return "utf"

The other changes are mainly to add inline comments to make the get_type function easier to parse and adding of unit tests.

src/hdmf/validate/validator.py Outdated Show resolved Hide resolved
@rly rly enabled auto-merge (squash) January 13, 2024 08:02
rly
rly previously approved these changes Jan 13, 2024
@rly rly merged commit 8fa2105 into dev Jan 13, 2024
27 checks passed
@rly rly deleted the fix_empty_validation branch January 13, 2024 08:07
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

Successfully merging this pull request may close these issues.

[Bug]: validation fails if file contains an empty dataset
3 participants