-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update dataset variable dropping method in
make_CHS_currents_file
w…
…orker (#294) * Change NowcastWorker mock to pytest fixture Test suite maintenance. re: issue #81 * Refactor run_type conditional to match case Updated the run_type conditionals from if-elif to a match case statement for better clarity and future extensibility. Added error handling to raise a WorkerError if the run_type is unexpected. Although the CLI parser handles that error, adding default case handling prevents static analysis warnings about possible variables references before assignment. * Fix param type definitions in docstrings Corrected the format of parameter type definitions in the docstrings for consistency and clarity. This change ensures better readability and proper documentation standards. * Change logging mocks to pytest caplog fixture Replace unittest.mock.patch decorator with pytest caplog fixture for tests of logging. Test suite maintenance re: issue #82. * Refactor lib.fix_perms patch to pytest fixture Replaced direct patching of fix_perms with a pytest fixture for better test structure and readability. This ensures the mock is applied more cleanly and isolated within the test context. * Refactor `_write_netcdf` patch to pytest fixture Replaced direct patching with a pytest fixture to mock the `_write_netcdf` function in unit tests for `make_CHS_currents_file`. This improves test maintainability and readability. Reorganized parameterized tests to adapt to the new mocking approach. * Refactor `_read_avg_unstagger_rotate` patch to pytest fixture Replace the @patch decorator with a pytest fixture for mock_read_avg_unstagger_rotate. This approach provides better clarity and modularity in the test structure, making it easier to manage and extend the tests. Removed the outdated test method that relied on the @patch decorator. * Update dropping variable in make_CHS_currents_file Replaced the deprecated 'drop' method with 'drop_vars' for removing the 'time_centered' variable. This ensures compatibility with newer versions of the xarray library. * Correct unlimited dimension in netCDF export Correct the unlimited dimension from "time" to "time_counter" when exporting to netCDF in make_CHS_currents_file.py. * Correct import statement for WorkerError PyCharm generated an import from a build/ directory that was just plain wrong! * Improve worker module docstring Corrected grammatical error and improved the wording of module docstring in `make_CHS_currents_file.py` and its associated tests. Ensured consistent use of terminology by changing "average" to "averages" and specifying "netCDF" instead of "nc file".
- Loading branch information
1 parent
4b539f1
commit 6a75b51
Showing
2 changed files
with
114 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters