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

Capture filename key warning in test #139

Merged
merged 2 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions test/test_conversion_driver_esm1p5.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,12 @@ def test_get_nc_write_path_unrecognized_unit():
nc_write_dir = Path("netCDF")
expected_nc_write_path = nc_write_dir / f"aiihca.p{unknown_key}-005007.nc"

nc_write_path = esm1p5_convert.get_nc_write_path(
Path(ff_name),
nc_write_dir,
(ff_year, ff_month, 1)
)
with pytest.warns(RuntimeWarning):
nc_write_path = esm1p5_convert.get_nc_write_path(
Path(ff_name),
nc_write_dir,
(ff_year, ff_month, 1)
)

assert nc_write_path == expected_nc_write_path

Expand Down
2 changes: 1 addition & 1 deletion umpost/conversion_driver_esm1p5.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def get_nc_filename(fields_file_name, date=None):
warnings.warn(
f"Unit code '{unit}' from filename f{fields_file_name} "
"not recognized. Frequency information will not be added "
"to the netCDF filename."
"to the netCDF filename.", RuntimeWarning
)
suffix = ""

Expand Down
Loading