fremor.tests.test_cmor_helpers_update_calendar module

tests for fremor.cmor_helpers.update_calendar_type

fremor.tests.test_cmor_helpers_update_calendar.temp_json_file(tmp_path)

Fixture to create a temporary JSON file for testing.

Args:

tmp_path: pytest’s fixture for temporary directories.

Returns:

Path to the temporary JSON file.

fremor.tests.test_cmor_helpers_update_calendar.temp_jsondecodeerr_json_file(tmp_path)

Create a file with invalid JSON content

fremor.tests.test_cmor_helpers_update_calendar.temp_keyerr_json_file(tmp_path)

Fixture to create a temporary JSON file for testing.

Args:

tmp_path: pytest’s fixture for temporary directories.

Returns:

Path to the temporary JSON file.

fremor.tests.test_cmor_helpers_update_calendar.test_calendars_are_equivalent_365_day_and_noleap()

365_day and noleap are CF aliases for the same calendar (reversed order)

fremor.tests.test_cmor_helpers_update_calendar.test_calendars_are_equivalent_all_leap_and_366_day()

all_leap and 366_day are CF aliases for the same calendar

fremor.tests.test_cmor_helpers_update_calendar.test_calendars_are_equivalent_case_insensitive()

comparison is case-insensitive

fremor.tests.test_cmor_helpers_update_calendar.test_calendars_are_equivalent_different_calendars()

distinct calendars should NOT be equivalent

fremor.tests.test_cmor_helpers_update_calendar.test_calendars_are_equivalent_noleap_and_365_day()

noleap and 365_day are CF aliases for the same calendar

fremor.tests.test_cmor_helpers_update_calendar.test_calendars_are_equivalent_same_name()

identical calendar names should be equivalent

fremor.tests.test_cmor_helpers_update_calendar.test_calendars_are_equivalent_standard_and_gregorian()

standard and gregorian are CF aliases for the same calendar

fremor.tests.test_cmor_helpers_update_calendar.test_get_time_calendar_fallback_calendar_type()

calendar_type is used when calendar attribute is absent

fremor.tests.test_cmor_helpers_update_calendar.test_get_time_calendar_missing_returns_none()

None is returned when neither calendar attribute is present

fremor.tests.test_cmor_helpers_update_calendar.test_get_time_calendar_prefers_calendar_attr()

calendar attribute takes priority over calendar_type

fremor.tests.test_cmor_helpers_update_calendar.test_normalize_calendar_365_day_passthrough()

365_day is already canonical

fremor.tests.test_cmor_helpers_update_calendar.test_normalize_calendar_366_day_passthrough()

366_day is already canonical

fremor.tests.test_cmor_helpers_update_calendar.test_normalize_calendar_all_leap()

all_leap is a CF alias for 366_day

fremor.tests.test_cmor_helpers_update_calendar.test_normalize_calendar_gregorian_passthrough()

gregorian is already canonical

fremor.tests.test_cmor_helpers_update_calendar.test_normalize_calendar_noleap()

noleap is a CF alias for 365_day

fremor.tests.test_cmor_helpers_update_calendar.test_normalize_calendar_none()

None input returns None

fremor.tests.test_cmor_helpers_update_calendar.test_normalize_calendar_standard()

standard is a CF alias for gregorian

fremor.tests.test_cmor_helpers_update_calendar.test_normalize_calendar_unknown_passthrough()

unknown calendars are lowercased and passed through

fremor.tests.test_cmor_helpers_update_calendar.test_update_calendar_type_alias_normalized(temp_json_file)

Calendar aliases should be normalized when updating the experiment config.

fremor.tests.test_cmor_helpers_update_calendar.test_update_calendar_type_json_dne_raise()

Test error raising when the input experiment json doesn’t exist

fremor.tests.test_cmor_helpers_update_calendar.test_update_calendar_type_jsondecode_raise(temp_jsondecodeerr_json_file)

Test raising a JSONDecodeError

fremor.tests.test_cmor_helpers_update_calendar.test_update_calendar_type_keyerror_raise(temp_keyerr_json_file)

Test error raising when the calendar key doesn’t exist

fremor.tests.test_cmor_helpers_update_calendar.test_update_calendar_type_success(temp_json_file)

Test successful update of ‘grid_label’ and ‘grid’ fields.

fremor.tests.test_cmor_helpers_update_calendar.test_update_calendar_type_unknown_err()

Test raising an exception not caught by the other ones

fremor.tests.test_cmor_helpers_update_calendar.test_update_calendar_type_valerr_raise(temp_json_file)

Test error raising when the input calendar is None