(dtype: str, dtype2: str)
| 97 | @pytest.mark.parametrize("dtype", ["u1", "u2", "i1", "i2", "f2", "f4"]) |
| 98 | @pytest.mark.parametrize("dtype2", ["f4", "f8"]) |
| 99 | def test_scaling_converts_to_float(dtype: str, dtype2: str) -> None: |
| 100 | dt = np.dtype(dtype2) |
| 101 | original = xr.Variable( |
| 102 | ("x",), np.arange(10, dtype=dtype), encoding=dict(scale_factor=dt.type(10)) |
| 103 | ) |
| 104 | coder = variables.CFScaleOffsetCoder() |
| 105 | encoded = coder.encode(original) |
| 106 | assert encoded.dtype == dt |
| 107 | roundtripped = coder.decode(encoded) |
| 108 | assert_identical(original, roundtripped) |
| 109 | assert roundtripped.dtype == dt |
| 110 | |
| 111 | |
| 112 | @pytest.mark.parametrize("scale_factor", (10, [10])) |
nothing calls this directly
no test coverage detected
searching dependent graphs…