-
Notifications
You must be signed in to change notification settings - Fork 6
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
Improve Testing #115
Improve Testing #115
Conversation
* add transect zarr from valentina * add transect evl and evr from subsampled transect evl and evr files
* add transect (zarr and evl) testing for lines
* remove computing since dask does this automatically in masking
* add compute data
* make sure that all values are within time range
* remove unused helper functions * remove old evr and nc file and replace with new evr and new zarr file
* sometimes M.data is computed automatically and sometimes it is not, so in the case where it is, we capture it in an exception
* add markers into pytest.ini
* rename test_lines file * check type for da_Sv * add marks * add fixtures * add numpy docstring * add hints * create test for mask errors * create test for masking empty lines object * create test checking for correct parsing values
* add more type hints for test_lines
* remove and replace redundant data_dir * add comments
* rename test_r2d to test_regions2d * add fixtures * add marks * add test for parsing * add test for to csv * add numpy docstrings * add hints
* test_convert's tests have been moved to other test files
* add marks * add type hints * add short merge test * add TODO
Codecov Report
@@ Coverage Diff @@
## main #115 +/- ##
==========================================
+ Coverage 80.21% 84.64% +4.42%
==========================================
Files 13 13
Lines 551 534 -17
==========================================
+ Hits 442 452 +10
+ Misses 109 82 -27
... and 1 file with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
* create parser code to handle empty regions and return empty dataset * create test for empty region * create data for empty region
* remove old tests
* implement read_evr handle missing bbox * create test data for missing bbox * create test for missing bbox
for more information, see https://pre-commit.ci
* dask computing is imprecise, so we use non-exact tests for tested values
* add todo for spline and krogh * remove krogh * add other interp options
* fix docstring in convert mask functions
* remove test_r2d (merge conflict)
* add r2d conversion mask tests from deleted test_r2d.py
for more information, see https://pre-commit.ci
* remove convert points * fix select region docstring
* cosmetic print changes
* remove test directory comment
* refactor test and test data in response to main merge
* update within_transect tests for cleanliness
* add new within_transect test data
Hey, could you guys take a look at this PR when you are free? @leewujung @valentina-s Mostly fixing up tests and some cosmetic/documentation modifications. Nothing really changed with functionality. |
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.
The fixture make the data loading for the tests really smooth! The tests look good, I added a few very minor comments.
end_time=end_date, | ||
max_depth=800, | ||
fill_between=True, | ||
) |
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.
did you intend to test compare this one against some plot or plot property or just want to see if it runs?
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.
To see if it runs!
echoregions/tests/test_regions2d.py
Outdated
|
||
Parameters | ||
---------- | ||
lines_fixture : Lines |
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.
regions2d_fixture : Regions2D
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.
Just fixed.
# within-transect. | ||
assert len(list(np.unique(M.data))) == 1 | ||
assert list(np.unique(M.data))[0] == 1 | ||
|
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.
test the dimensions, and the 0 values, in case we change something 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.
Tested the 0 index values by checking counts and tested for M's dimensions.
|
||
|
||
@pytest.mark.regions2d | ||
def test_select_sonar_file(regions2d_fixture: Regions2D) -> None: |
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.
maybe test the case when sonar filenames do not follow expected format. Can also add in the documentation of the select_sonar_file
that is specific to SIMRAD format and write it out how it looks like.
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.
Sounds good. Added a test and checks for valid SIMRAD and sonar_file_inputs.
* fix test EVR to file documentation * add test for dimensions and 1 values for test_within_transect * add test for selection of bad sonar files and add code for checking for invalid inputs for SIMRAD parsing * add documentation for explaining SIMRAD format.
* change raw_fname from str to list
Hey @valentina-s, just addressed your comments in the most recent pushes! |
# This entire .zarr file should be covered by the single start and end transect period | ||
# found in the EVR file, so the only values listed should be 1, implying everything is | ||
# within-transect. | ||
assert len(list(np.unique(M.data))) == 1 | ||
assert list(np.unique(M.data))[0] == 1 | ||
|
||
# Test number of 1 values | ||
assert np.unique(M.data, return_counts=True)[1][0] == 6648355 |
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.
I was thinking to test the actual shape, in case in future we transpose something.
* use isinstance instead of type for region_ids checking
* check for M.shape instead of M.sizes
Improve Testing
This PR addresses #58, #107, #85, #112, #113, #99, #53, #28, #120: