Skip to content

Conversation

@rly
Copy link
Contributor

@rly rly commented Dec 8, 2023

Motivation

Fix #1001

Added hooks for validating Data objects when data is being set to a new array, a new element is being added to data, and when data is being extended with an iterable.

This will be useful when #868 is finished.

This does NOT check when Data.data is set to a mutable object like a list and that list object is modified, e.g.,

e = ElementIdentifiers(name="ids", data=[1, 2, 3])
e.data.append("test")  # will work
e.append("test")  # will raise error now

I do not think it is possible to stop the above operation.

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 oruebel December 8, 2023 01:19
@codecov
Copy link

codecov bot commented Dec 8, 2023

Codecov Report

Attention: Patch coverage is 88.46154% with 3 lines in your changes missing coverage. Please review.

Project coverage is 88.57%. Comparing base (af13e72) to head (a4a593e).
Report is 88 commits behind head on dev.

Files with missing lines Patch % Lines
src/hdmf/data_utils.py 0.00% 1 Missing and 1 partial ⚠️
src/hdmf/utils.py 83.33% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #1009   +/-   ##
=======================================
  Coverage   88.57%   88.57%           
=======================================
  Files          45       45           
  Lines        9484     9503   +19     
  Branches     2697     2702    +5     
=======================================
+ Hits         8400     8417   +17     
- Misses        763      764    +1     
- Partials      321      322    +1     

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

@rly rly merged commit 97260bc into dev Dec 8, 2023
@rly rly deleted the validate_type_element_ids branch December 8, 2023 06:06
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]: Setting ids with non integers value is accepted in Dynamic Table but fails when converting to dataframe

3 participants