Skip to content

Add type hints to test_dtypes #7858

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

Merged
merged 1 commit into from
May 21, 2023
Merged
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
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