Skip to content

Commit

Permalink
Try combining Unix and Windows dtype repr tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mgorny committed Jun 15, 2024
1 parent b8ad15d commit 2c8f6c3
Showing 1 changed file with 0 additions and 45 deletions.
45 changes: 0 additions & 45 deletions xarray/tests/test_formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
from xarray.core.datatree import DataTree # TODO: Remove when can do xr.DataTree
from xarray.tests import requires_cftime, requires_dask, requires_netCDF4

ON_WINDOWS = sys.platform == "win32"


class TestFormatting:
def test_get_indexer_at_least_n_items(self) -> None:
Expand Down Expand Up @@ -1071,13 +1069,6 @@ def test_array_repr_dtypes():
""".strip()
assert actual == expected


@pytest.mark.skipif(
ON_WINDOWS,
reason="Default numpy's dtypes vary according to OS",
)
def test_array_repr_dtypes_unix() -> None:

# Signed integer dtypes

array = np.array([0])
Expand Down Expand Up @@ -1109,39 +1100,3 @@ def test_array_repr_dtypes_unix() -> None:
Dimensions without coordinates: x
""".strip()
assert actual == expected


@pytest.mark.skipif(
not ON_WINDOWS,
reason="Default numpy's dtypes vary according to OS",
)
def test_array_repr_dtypes_on_windows() -> None:

# Integer dtypes

ds = xr.DataArray(np.array([0]), dims="x")
actual = repr(ds)
expected = """
<xarray.DataArray (x: 1)> Size: 4B
array([0])
Dimensions without coordinates: x
""".strip()
assert actual == expected

ds = xr.DataArray(np.array([0], dtype="int32"), dims="x")
actual = repr(ds)
expected = """
<xarray.DataArray (x: 1)> Size: 4B
array([0])
Dimensions without coordinates: x
""".strip()
assert actual == expected

ds = xr.DataArray(np.array([0], dtype="int64"), dims="x")
actual = repr(ds)
expected = """
<xarray.DataArray (x: 1)> Size: 8B
array([0], dtype=int64)
Dimensions without coordinates: x
""".strip()
assert actual == expected

0 comments on commit 2c8f6c3

Please sign in to comment.