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

Fix various warnings revealed by pytest #273

Merged
merged 5 commits into from
Jun 14, 2024
Merged

Conversation

douglatornell
Copy link
Member

Most are FutureWarning messages from pandas and xarray. One is an expected PArserWarning from pandas that we now capture and inspect.

Change to lowercase "s" for seconds frequency in the sample time pandas
date range generation in test_get_onc_ferry unit test. This change resolves:

    FutureWarning: 'S' is deprecated and will be removed in a future version,
    please use 's' instead.
The delimiter for the pandas.read_csv() function has been changed from
`delim_whitespace=True` to `sep="\s+"`. This change resolves:

    FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated
    and will be removed in a future version. Use ``sep='\s+'`` instead.
Changed the assertions to use 'sizes' instead of 'dims'. This change resolves:

    FutureWarning: The return type of `Dataset.dims` will be changed to return
    a set of dimension names in future, in order to be more consistent with
    `DataArray.dims`. To access a mapping from dimension names to lengths,
    please use `Dataset.sizes`.
Updated the test_daily_river_flows.TestReadRiverCSV.test_one_long_line() test
to assert the expected ParserWarning. This warning is raised when there are
differences in the lengths of the lines being parsed in the CSV data. Now, the
test checks the warning's content to confirm its origin from mismatched length.
Modified how Theodosia "Secondary River Flow" data is filled in case of null
values in the 'daily_river_flows' and 'make_v202111_runoff_file' workers.
Instead of using inplace=True method, a more explicit assignment operation has
been used to ensure compatibility with pandas 3.0. This change resolves:

    FutureWarning: A value is trying to be set on a copy of a DataFrame or
    Series through chained assignment using an inplace method. The behavior
    will change in pandas 3.0. This inplace method will never work because the
    intermediate object on which we are setting values always behaves as a copy.

     For example, when doing 'df[col].method(value, inplace=True)', try using
     'df.method({col: value}, inplace=True)' or df[col] = df[col].method(value)
     instead, to perform the operation inplace on the original object.
@douglatornell douglatornell added the maintenance Codebase maintenance label Jun 14, 2024
@douglatornell douglatornell added this to the v24.2 milestone Jun 14, 2024
Copy link

codecov bot commented Jun 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.64%. Comparing base (650e511) to head (b6aaf10).
Report is 24 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #273   +/-   ##
=======================================
  Coverage   77.64%   77.64%           
=======================================
  Files         133      133           
  Lines       18695    18698    +3     
  Branches     1910     1911    +1     
=======================================
+ Hits        14515    14518    +3     
  Misses       4113     4113           
  Partials       67       67           
Flag Coverage Δ
unittests 77.64% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@douglatornell douglatornell merged commit 81e4d25 into main Jun 14, 2024
8 checks passed
@douglatornell douglatornell deleted the fix-pytest-warnings branch June 14, 2024 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Codebase maintenance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant