-
Notifications
You must be signed in to change notification settings - Fork 86
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
Enhance unit test coverage #2031
base: dev
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #2031 +/- ##
==========================================
+ Coverage 91.73% 94.22% +2.48%
==========================================
Files 27 27
Lines 2722 2718 -4
Branches 710 708 -2
==========================================
+ Hits 2497 2561 +64
+ Misses 149 94 -55
+ Partials 76 63 -13
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@stephprince should this PR target the |
Since you mentioned there are breaking changes, I think this should target the 3.0 release branch. But I can review and take a closer look. |
Sounds good. Feel free to modify the PR as necessary. If you prefer, it should be pretty straight forward to just move the breaking changes to a separate PR since its just removes a few functions that were no longer used anywhere. |
…allowed for read of old data
68deffc
to
eba14a8
Compare
@stephprince @rly to simplify things I have moved all breaking changes to a new PR #2036. This PR is good to go from my end. |
@@ -338,7 +338,7 @@ def add_roi(self, **kwargs): | |||
"""Add a Region Of Interest (ROI) data to this""" | |||
pixel_mask, voxel_mask, image_mask = popargs('pixel_mask', 'voxel_mask', 'image_mask', kwargs) | |||
if image_mask is None and pixel_mask is None and voxel_mask is None: | |||
raise ValueError("Must provide 'image_mask' and/or 'pixel_mask'") | |||
raise ValueError("Must provide at least on of 'image_mask', 'pixel_mask', or 'voxel_mask'") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
raise ValueError("Must provide at least on of 'image_mask', 'pixel_mask', or 'voxel_mask'") | |
raise ValueError("Must provide at least one of 'image_mask', 'pixel_mask', or 'voxel_mask'") |
@@ -141,12 +154,18 @@ def __init__(self, **kwargs): | |||
|
|||
@property | |||
def notes(self): | |||
""" | |||
Get the notes attribute. This will be deprecated in the future. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Get the notes attribute. This will be deprecated in the future. | |
Get the notes attribute. Use of ScratchData.notes has been deprecated and will be removed in PyNWB 4.0. |
warn('Use of ScratchData.notes will be deprecated. Use ScratchData.description instead.', | ||
PendingDeprecationWarning) | ||
return self.description | ||
|
||
@notes.setter | ||
def notes(self, value): | ||
""" | ||
Set the notes attribute. This will be deprecated in the future. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set the notes attribute. This will be deprecated in the future. | |
Set the notes attribute. Use of ScratchData.notes has been deprecated and will be removed in PyNWB 4.0. |
@@ -558,6 +576,13 @@ def test_init_3d_image_mask(self): | |||
self.assertTrue(np.allclose(pS['image_mask'][0], img_masks[0])) | |||
self.assertTrue(np.allclose(pS['image_mask'][1], img_masks[1])) | |||
|
|||
def test_add_roi_missing_params(self): | |||
_, _, pS = self.create_basic_plane_segmentation() | |||
msg = "Must provide at least on of 'image_mask', 'pixel_mask', or 'voxel_mask'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
msg = "Must provide at least on of 'image_mask', 'pixel_mask', or 'voxel_mask'" | |
msg = "Must provide at least one of 'image_mask', 'pixel_mask', or 'voxel_mask'" |
def test_add_interval_tags_string(self): | ||
"""Test adding interval with tags as comma-separated string""" | ||
epochs = TimeIntervals(name='test_epochs') | ||
epochs.add_interval(start_time=10.0, stop_time=20.0, tags='tag1, tag2, tag3') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should tags be allowed to be supplied this way? It feels like this approach could be prone to misunderstandings on how the data gets written.
Looking at the line of code that this is testing and the tests that fail if you remove it:
Line 48 in 5564f82
tags = [s.strip() for s in tags.split(",") if not s.isspace()] |
it seems this line is currently mostly important for converting the tags argument to a list if a single string is provided. (This issue might be also related to hdmf-dev/hdmf#1211, where we discussed deprecating the ability to provide a single string for a ragged column.)
Motivation
Add unit tests to enhance overall test coverage for
core.py
,image.py
,spec.py
,icephys.py
,epoch.py
IntracellularRecordingsTable
, theIntracellularResponseTable
was not being initialized correctly when empty category tables were providedSpikeEventSeries
to handle the case whereAbstractDataChunkIterator
are used for timestamps/dataChecklist
ruff check . && codespell
from the source directory.