(
freq, time_unit: PDDatetimeUnitOptions
)
| 1107 | |
| 1108 | @pytest.mark.parametrize("freq", FREQUENCIES_TO_ENCODING_UNITS.keys()) |
| 1109 | def test_encode_decode_roundtrip_datetime64( |
| 1110 | freq, time_unit: PDDatetimeUnitOptions |
| 1111 | ) -> None: |
| 1112 | # See GH 4045. Prior to GH 4684 this test would fail for frequencies of |
| 1113 | # "s", "ms", "us", and "ns". |
| 1114 | initial_time = pd.date_range("1678-01-01", periods=1) |
| 1115 | times = initial_time.append(pd.date_range("1968", periods=2, freq=freq)) |
| 1116 | variable = Variable(["time"], times) |
| 1117 | encoded = conventions.encode_cf_variable(variable) |
| 1118 | decoded = conventions.decode_cf_variable( |
| 1119 | "time", encoded, decode_times=CFDatetimeCoder(time_unit=time_unit) |
| 1120 | ) |
| 1121 | assert_equal(variable, decoded) |
| 1122 | |
| 1123 | |
| 1124 | @requires_cftime |
nothing calls this directly
no test coverage detected
searching dependent graphs…