Skip to content

Commit

Permalink
Add type hints to test_dtypes (#7858)
Browse files Browse the repository at this point in the history
  • Loading branch information
Illviljan authored May 21, 2023
1 parent 05c7888 commit d8ec3a3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions xarray/tests/test_dtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@
([np.bytes_, np.unicode_], np.object_),
],
)
def test_result_type(args, expected):
def test_result_type(args, expected) -> None:
actual = dtypes.result_type(*args)
assert actual == expected


def test_result_type_scalar():
def test_result_type_scalar() -> None:
actual = dtypes.result_type(np.arange(3, dtype=np.float32), np.nan)
assert actual == np.float32


def test_result_type_dask_array():
def test_result_type_dask_array() -> None:
# verify it works without evaluating dask arrays
da = pytest.importorskip("dask.array")
dask = pytest.importorskip("dask")
Expand All @@ -50,7 +50,7 @@ def error():


@pytest.mark.parametrize("obj", [1.0, np.inf, "ab", 1.0 + 1.0j, True])
def test_inf(obj):
def test_inf(obj) -> None:
assert dtypes.INF > obj
assert dtypes.NINF < obj

Expand Down Expand Up @@ -85,7 +85,7 @@ def test_inf(obj):
("V", (np.dtype("O"), "nan")), # dtype('V')
],
)
def test_maybe_promote(kind, expected):
def test_maybe_promote(kind, expected) -> None:
# 'g': np.float128 is not tested : not available on all platforms
# 'G': np.complex256 is not tested : not available on all platforms

Expand All @@ -94,7 +94,7 @@ def test_maybe_promote(kind, expected):
assert str(actual[1]) == expected[1]


def test_nat_types_membership():
def test_nat_types_membership() -> None:
assert np.datetime64("NaT").dtype in dtypes.NAT_TYPES
assert np.timedelta64("NaT").dtype in dtypes.NAT_TYPES
assert np.float64 not in dtypes.NAT_TYPES

0 comments on commit d8ec3a3

Please sign in to comment.