Add a simple nbytes
representation in DataArrays and Dataset repr
#11314
26 fail, 1 845 skipped, 17 981 pass in 1h 41m 19s
Annotations
Check warning on line 0 in xarray.tests.test_dataarray.TestDataArray
github-actions / Test Results
All 12 runs failed: test_repr (xarray.tests.test_dataarray.TestDataArray)
artifacts/Test results for Linux-3.10 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 bare-minimum/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
AssertionError: assert '<xarray.Data...foo: bar' == '<xarray.Data...foo: bar'
Skipping 38 identical leading characters in diff, use -v to show
- 2, x: 3)> Size: 48B
+ 2, x: 3)>
array([[1, 2, 3],
[4, 5, 6]])
Coordinates:
- * x (x) int64 24B 0 1 2
? ----
+ * x (x) int64 0 1 2
- other int64 8B 0
? ---
+ other int64 0
Dimensions without coordinates: time
Attributes:
foo: bar
self = <xarray.tests.test_dataarray.TestDataArray object at 0x1598eb730>
def test_repr(self) -> None:
v = Variable(["time", "x"], [[1, 2, 3], [4, 5, 6]], {"foo": "bar"})
coords = {"x": np.arange(3, dtype=np.int64), "other": np.int64(0)}
data_array = DataArray(v, coords, name="my_variable")
expected = dedent(
"""\
<xarray.DataArray 'my_variable' (time: 2, x: 3)>
array([[1, 2, 3],
[4, 5, 6]])
Coordinates:
* x (x) int64 0 1 2
other int64 0
Dimensions without coordinates: time
Attributes:
foo: bar"""
)
> assert expected == repr(data_array)
E AssertionError: assert '<xarray.Data...foo: bar' == '<xarray.Data...foo: bar'
E
E Skipping 38 identical leading characters in diff, use -v to show
E - 2, x: 3)> Size: 48B
E + 2, x: 3)>
E array([[1, 2, 3],
E [4, 5, 6]])
E Coordinates:
E - * x (x) int64 24B 0 1 2
E ? ----
E + * x (x) int64 0 1 2
E - other int64 8B 0
E ? ---
E + other int64 0
E Dimensions without coordinates: time
E Attributes:
E foo: bar
/Users/runner/work/xarray/xarray/xarray/tests/test_dataarray.py:106: AssertionError
Check warning on line 0 in xarray.tests.test_dataarray.TestDataArray
github-actions / Test Results
All 12 runs failed: test_repr_multiindex (xarray.tests.test_dataarray.TestDataArray)
artifacts/Test results for Linux-3.10 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 bare-minimum/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
AssertionError: assert '<xarray.Data...int64 1 2 1 2' == '<xarray.Data...4 32B 1 2 1 2'
- <xarray.DataArray (x: 4)> Size: 32B
? ----------
+ <xarray.DataArray (x: 4)>
array([0, 1, 2, 3])
Coordinates:
- * x (x) object 32B MultiIndex
? ----
+ * x (x) object MultiIndex
- * level_1 (x) object 32B 'a' 'a' 'b' 'b'
? ----
+ * level_1 (x) object 'a' 'a' 'b' 'b'
- * level_2 (x) int64 32B 1 2 1 2
? ^ - ----
+ * level_2 (x) int64 1 2 1 2
? ^^
self = <xarray.tests.test_dataarray.TestDataArray object at 0x1598eb400>
def test_repr_multiindex(self) -> None:
expected = dedent(
"""\
<xarray.DataArray (x: 4)>
array([0, 1, 2, 3])
Coordinates:
* x (x) object MultiIndex
* level_1 (x) object 'a' 'a' 'b' 'b'
* level_2 (x) int64 1 2 1 2"""
)
> assert expected == repr(self.mda)
E AssertionError: assert '<xarray.Data...int64 1 2 1 2' == '<xarray.Data...4 32B 1 2 1 2'
E
E - <xarray.DataArray (x: 4)> Size: 32B
E ? ----------
E + <xarray.DataArray (x: 4)>
E array([0, 1, 2, 3])
E Coordinates:
E - * x (x) object 32B MultiIndex
E ? ----
E + * x (x) object MultiIndex
E - * level_1 (x) object 32B 'a' 'a' 'b' 'b'
E ? ----
E + * level_1 (x) object 'a' 'a' 'b' 'b'
E - * level_2 (x) int64 32B 1 2 1 2
E ? ^ - ----
E + * level_2 (x) int64 1 2 1 2
E ? ^^
/Users/runner/work/xarray/xarray/xarray/tests/test_dataarray.py:118: AssertionError
Check warning on line 0 in xarray.tests.test_dataarray.TestDataArray
github-actions / Test Results
All 12 runs failed: test_repr_multiindex_long (xarray.tests.test_dataarray.TestDataArray)
artifacts/Test results for Linux-3.10 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 bare-minimum/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
AssertionError: assert '<xarray.Data...2 3 4 5 6 7 8' == '<xarray.Data...2 3 4 5 6 7 8'
- <xarray.DataArray (x: 32)> Size: 256B
? -----------
+ <xarray.DataArray (x: 32)>
array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31])
Coordinates:
- * x (x) object 256B MultiIndex
? -----
+ * x (x) object MultiIndex
- * level_1 (x) object 256B 'a' 'a' 'a' 'a' 'a' 'a' ... 'd' 'd' 'd' 'd' 'd' 'd'
? -----
+ * level_1 (x) object 'a' 'a' 'a' 'a' 'a' 'a' 'a' ... 'd' 'd' 'd' 'd' 'd' 'd'
? ++++
- * level_2 (x) int64 256B 1 2 3 4 5 6 7 8 1 2 3 4 ... 5 6 7 8 1 2 3 4 5 6 7 8
? ^ ------------
+ * level_2 (x) int64 1 2 3 4 5 6 7 8 1 2 3 4 5 6 ... 4 5 6 7 8 1 2 3 4 5 6 7 8
? ++ +++++ + ^^^^ ++
self = <xarray.tests.test_dataarray.TestDataArray object at 0x159905670>
def test_repr_multiindex_long(self) -> None:
mindex_long = pd.MultiIndex.from_product(
[["a", "b", "c", "d"], [1, 2, 3, 4, 5, 6, 7, 8]],
names=("level_1", "level_2"),
)
mda_long = DataArray(list(range(32)), coords={"x": mindex_long}, dims="x")
expected = dedent(
"""\
<xarray.DataArray (x: 32)>
array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31])
Coordinates:
* x (x) object MultiIndex
* level_1 (x) object 'a' 'a' 'a' 'a' 'a' 'a' 'a' ... 'd' 'd' 'd' 'd' 'd' 'd'
* level_2 (x) int64 1 2 3 4 5 6 7 8 1 2 3 4 5 6 ... 4 5 6 7 8 1 2 3 4 5 6 7 8"""
)
> assert expected == repr(mda_long)
E AssertionError: assert '<xarray.Data...2 3 4 5 6 7 8' == '<xarray.Data...2 3 4 5 6 7 8'
E
E - <xarray.DataArray (x: 32)> Size: 256B
E ? -----------
E + <xarray.DataArray (x: 32)>
E array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
E 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31])
E Coordinates:
E - * x (x) object 256B MultiIndex
E ? -----
E + * x (x) object MultiIndex
E - * level_1 (x) object 256B 'a' 'a' 'a' 'a' 'a' 'a' ... 'd' 'd' 'd' 'd' 'd' 'd'
E ? -----
E + * level_1 (x) object 'a' 'a' 'a' 'a' 'a' 'a' 'a' ... 'd' 'd' 'd' 'd' 'd' 'd'
E ? ++++
E - * level_2 (x) int64 256B 1 2 3 4 5 6 7 8 1 2 3 4 ... 5 6 7 8 1 2 3 4 5 6 7 8
E ? ^ ------------
E + * level_2 (x) int64 1 2 3 4 5 6 7 8 1 2 3 4 5 6 ... 4 5 6 7 8 1 2 3 4 5 6 7 8
E ? ++ +++++ + ^^^^ ++
/Users/runner/work/xarray/xarray/xarray/tests/test_dataarray.py:136: AssertionError
Check warning on line 0 in xarray.tests.test_dataarray.TestDataArray
github-actions / Test Results
All 12 runs failed: test_coords (xarray.tests.test_dataarray.TestDataArray)
artifacts/Test results for Linux-3.10 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 bare-minimum/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
AssertionError: assert 'Coordinates:...) int64 0 1 2' == 'Coordinates:...t64 24B 0 1 2'
Coordinates:
- * x (x) int64 16B -1 -2
? ----
+ * x (x) int64 -1 -2
- * y (y) int64 24B 0 1 2
? --------
+ * y (y) int64 0 1 2
? ++++
self = <xarray.tests.test_dataarray.TestDataArray object at 0x159a1e6a0>
def test_coords(self) -> None:
# use int64 to ensure repr() consistency on windows
coords = [
IndexVariable("x", np.array([-1, -2], "int64")),
IndexVariable("y", np.array([0, 1, 2], "int64")),
]
da = DataArray(np.random.randn(2, 3), coords, name="foo")
# len
assert len(da.coords) == 2
# iter
assert list(da.coords) == ["x", "y"]
assert coords[0].identical(da.coords["x"])
assert coords[1].identical(da.coords["y"])
assert "x" in da.coords
assert 0 not in da.coords
assert "foo" not in da.coords
with pytest.raises(KeyError):
da.coords[0]
with pytest.raises(KeyError):
da.coords["foo"]
# repr
expected_repr = dedent(
"""\
Coordinates:
* x (x) int64 -1 -2
* y (y) int64 0 1 2"""
)
actual = repr(da.coords)
> assert expected_repr == actual
E AssertionError: assert 'Coordinates:...) int64 0 1 2' == 'Coordinates:...t64 24B 0 1 2'
E
E Coordinates:
E - * x (x) int64 16B -1 -2
E ? ----
E + * x (x) int64 -1 -2
E - * y (y) int64 24B 0 1 2
E ? --------
E + * y (y) int64 0 1 2
E ? ++++
/Users/runner/work/xarray/xarray/xarray/tests/test_dataarray.py:1452: AssertionError
Check warning on line 0 in xarray.tests.test_dataset.TestDataset
github-actions / Test Results
All 12 runs failed: test_coords_properties (xarray.tests.test_dataset.TestDataset)
artifacts/Test results for Linux-3.10 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 bare-minimum/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
AssertionError: assert 'Coordinates:... int64 -10' == 'Coordinates:... int64 8B -10'
Coordinates:
- * x (x) int64 16B -1 -2
? ----
+ * x (x) int64 -1 -2
- * y (y) int64 24B 0 1 2
? ----
+ * y (y) int64 0 1 2
- a (x) int64 16B 4 5
? ----
+ a (x) int64 4 5
- b int64 8B -10
? ---
+ b int64 -10
self = <xarray.tests.test_dataset.TestDataset object at 0x15cd32fa0>
def test_coords_properties(self) -> None:
# use int64 for repr consistency on windows
data = Dataset(
{
"x": ("x", np.array([-1, -2], "int64")),
"y": ("y", np.array([0, 1, 2], "int64")),
"foo": (["x", "y"], np.random.randn(2, 3)),
},
{"a": ("x", np.array([4, 5], "int64")), "b": np.int64(-10)},
)
coords = data.coords
assert isinstance(coords, DatasetCoordinates)
# len
assert len(coords) == 4
# iter
assert list(coords) == ["x", "y", "a", "b"]
assert_identical(coords["x"].variable, data["x"].variable)
assert_identical(coords["y"].variable, data["y"].variable)
assert "x" in coords
assert "a" in coords
assert 0 not in coords
assert "foo" not in coords
with pytest.raises(KeyError):
coords["foo"]
with pytest.raises(KeyError):
coords[0]
# repr
expected = dedent(
"""\
Coordinates:
* x (x) int64 -1 -2
* y (y) int64 0 1 2
a (x) int64 4 5
b int64 -10"""
)
actual = repr(coords)
> assert expected == actual
E AssertionError: assert 'Coordinates:... int64 -10' == 'Coordinates:... int64 8B -10'
E
E Coordinates:
E - * x (x) int64 16B -1 -2
E ? ----
E + * x (x) int64 -1 -2
E - * y (y) int64 24B 0 1 2
E ? ----
E + * y (y) int64 0 1 2
E - a (x) int64 16B 4 5
E ? ----
E + a (x) int64 4 5
E - b int64 8B -10
E ? ---
E + b int64 -10
/Users/runner/work/xarray/xarray/xarray/tests/test_dataset.py:892: AssertionError
Check warning on line 0 in xarray.tests.test_dataset.TestDataset
github-actions / Test Results
All 12 runs failed: test_data_vars_properties (xarray.tests.test_dataset.TestDataset)
artifacts/Test results for Linux-3.10 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 bare-minimum/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
AssertionError: assert 'Data variabl... float64 2.0' == 'Data variabl...loat64 8B 2.0'
Data variables:
- foo (x) float64 8B 1.0
? ---
+ foo (x) float64 1.0
- bar float64 8B 2.0
? ---
+ bar float64 2.0
self = <xarray.tests.test_dataset.TestDataset object at 0x15cd32e20>
def test_data_vars_properties(self) -> None:
ds = Dataset()
ds["foo"] = (("x",), [1.0])
ds["bar"] = 2.0
# iter
assert set(ds.data_vars) == {"foo", "bar"}
assert "foo" in ds.data_vars
assert "x" not in ds.data_vars
assert_identical(ds["foo"], ds.data_vars["foo"])
# repr
expected = dedent(
"""\
Data variables:
foo (x) float64 1.0
bar float64 2.0"""
)
actual = repr(ds.data_vars)
> assert expected == actual
E AssertionError: assert 'Data variabl... float64 2.0' == 'Data variabl...loat64 8B 2.0'
E
E Data variables:
E - foo (x) float64 8B 1.0
E ? ---
E + foo (x) float64 1.0
E - bar float64 8B 2.0
E ? ---
E + bar float64 2.0
/Users/runner/work/xarray/xarray/xarray/tests/test_dataset.py:1083: AssertionError
Check warning on line 0 in xarray.tests.test_dataset.TestDataset
github-actions / Test Results
All 12 runs failed: test_repr (xarray.tests.test_dataset.TestDataset)
artifacts/Test results for Linux-3.10 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 bare-minimum/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
AssertionError: assert '<xarray.Data...foo: bar' == '<xarray.Data...foo: bar'
- <xarray.Dataset> Size: 2kB
? ----------
+ <xarray.Dataset>
Dimensions: (dim2: 9, dim3: 10, time: 20, dim1: 8)
Coordinates:
- * dim2 (dim2) float64 72B 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0
? ----
+ * dim2 (dim2) float64 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0
- * dim3 (dim3) <U1 40B 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j'
? ----
+ * dim3 (dim3) <U1 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j'
- * time (time) datetime64[ns] 160B 2000-01-01 2000-01-02 ... 2000-01-20
? -----
+ * time (time) datetime64[ns] 2000-01-01 2000-01-02 ... 2000-01-20
- numbers (dim3) int64 80B 0 1 2 0 0 1 1 2 2 3
? - ^ -------- --
+ numbers (dim3) int64 0 1 2 0 0 1 1 2 2 3
? ^^^^ ++ ++
Dimensions without coordinates: dim1
Data variables:
- var1 (dim1, dim2) float64 576B -1.086 0.9973 0.283 ... 0.4684 -0.8312
? -----
+ var1 (dim1, dim2) float64 -1.086 0.9973 0.283 ... 0.1995 0.4684 -0.8312
? +++++++
- var2 (dim1, dim2) float64 576B 1.162 -1.097 -2.123 ... 1.267 0.3328
? -----
+ var2 (dim1, dim2) float64 1.162 -1.097 -2.123 ... 0.1302 1.267 0.3328
? +++++++
- var3 (dim3, dim1) float64 640B 0.5565 -0.2121 0.4563 ... -0.2452 -0.3616
? -----
+ var3 (dim3, dim1) float64 0.5565 -0.2121 0.4563 ... -0.2452 -0.3616
Attributes:
foo: bar
self = <xarray.tests.test_dataset.TestDataset object at 0x15ae63460>
def test_repr(self) -> None:
data = create_test_data(seed=123)
data.attrs["foo"] = "bar"
# need to insert str dtype at runtime to handle different endianness
expected = dedent(
"""\
<xarray.Dataset>
Dimensions: (dim2: 9, dim3: 10, time: 20, dim1: 8)
Coordinates:
* dim2 (dim2) float64 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0
* dim3 (dim3) %s 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j'
* time (time) datetime64[ns] 2000-01-01 2000-01-02 ... 2000-01-20
numbers (dim3) int64 0 1 2 0 0 1 1 2 2 3
Dimensions without coordinates: dim1
Data variables:
var1 (dim1, dim2) float64 -1.086 0.9973 0.283 ... 0.1995 0.4684 -0.8312
var2 (dim1, dim2) float64 1.162 -1.097 -2.123 ... 0.1302 1.267 0.3328
var3 (dim3, dim1) float64 0.5565 -0.2121 0.4563 ... -0.2452 -0.3616
Attributes:
foo: bar"""
% data["dim3"].dtype
)
actual = "\n".join(x.rstrip() for x in repr(data).split("\n"))
print(actual)
> assert expected == actual
E AssertionError: assert '<xarray.Data...foo: bar' == '<xarray.Data...foo: bar'
E
E - <xarray.Dataset> Size: 2kB
E ? ----------
E + <xarray.Dataset>
E Dimensions: (dim2: 9, dim3: 10, time: 20, dim1: 8)
E Coordinates:
E - * dim2 (dim2) float64 72B 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0
E ? ----
E + * dim2 (dim2) float64 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0
E - * dim3 (dim3) <U1 40B 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j'
E ? ----
E + * dim3 (dim3) <U1 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j'
E - * time (time) datetime64[ns] 160B 2000-01-01 2000-01-02 ... 2000-01-20
E ? -----
E + * time (time) datetime64[ns] 2000-01-01 2000-01-02 ... 2000-01-20
E - numbers (dim3) int64 80B 0 1 2 0 0 1 1 2 2 3
E ? - ^ -------- --
E + numbers (dim3) int64 0 1 2 0 0 1 1 2 2 3
E ? ^^^^ ++ ++
E Dimensions without coordinates: dim1
E Data variables:
E - var1 (dim1, dim2) float64 576B -1.086 0.9973 0.283 ... 0.4684 -0.8312
E ? -----
E + var1 (dim1, dim2) float64 -1.086 0.9973 0.283 ... 0.1995 0.4684 -0.8312
E ? +++++++
E - var2 (dim1, dim2) float64 576B 1.162 -1.097 -2.123 ... 1.267 0.3328
E ? -----
E + var2 (dim1, dim2) float64 1.162 -1.097 -2.123 ... 0.1302 1.267 0.3328
E ? +++++++
E - var3 (dim3, dim1) float64 640B 0.5565 -0.2121 0.4563 ... -0.2452 -0.3616
E ? -----
E + var3 (dim3, dim1) float64 0.5565 -0.2121 0.4563 ... -0.2452 -0.3616
E Attributes:
E foo: bar
/Users/runner/work/xarray/xarray/xarray/tests/test_dataset.py:310: AssertionError
Check warning on line 0 in xarray.tests.test_dataset.TestDataset
github-actions / Test Results
All 12 runs failed: test_repr_multiindex (xarray.tests.test_dataset.TestDataset)
artifacts/Test results for Linux-3.10 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 bare-minimum/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
AssertionError: assert '<xarray.Data...\n *empty*' == '<xarray.Data...\n *empty*'
- <xarray.Dataset> Size: 96B
? ----------
+ <xarray.Dataset>
Dimensions: (x: 4)
Coordinates:
- * x (x) object 32B MultiIndex
? ----
+ * x (x) object MultiIndex
- * level_1 (x) object 32B 'a' 'a' 'b' 'b'
? ----
+ * level_1 (x) object 'a' 'a' 'b' 'b'
- * level_2 (x) int64 32B 1 2 1 2
? ^ - ----
+ * level_2 (x) int64 1 2 1 2
? ^^
Data variables:
*empty*
self = <xarray.tests.test_dataset.TestDataset object at 0x15ae63a90>
def test_repr_multiindex(self) -> None:
data = create_test_multiindex()
expected = dedent(
"""\
<xarray.Dataset>
Dimensions: (x: 4)
Coordinates:
* x (x) object MultiIndex
* level_1 (x) object 'a' 'a' 'b' 'b'
* level_2 (x) int64 1 2 1 2
Data variables:
*empty*"""
)
actual = "\n".join(x.rstrip() for x in repr(data).split("\n"))
print(actual)
> assert expected == actual
E AssertionError: assert '<xarray.Data...\n *empty*' == '<xarray.Data...\n *empty*'
E
E - <xarray.Dataset> Size: 96B
E ? ----------
E + <xarray.Dataset>
E Dimensions: (x: 4)
E Coordinates:
E - * x (x) object 32B MultiIndex
E ? ----
E + * x (x) object MultiIndex
E - * level_1 (x) object 32B 'a' 'a' 'b' 'b'
E ? ----
E + * level_1 (x) object 'a' 'a' 'b' 'b'
E - * level_2 (x) int64 32B 1 2 1 2
E ? ^ - ----
E + * level_2 (x) int64 1 2 1 2
E ? ^^
E Data variables:
E *empty*
/Users/runner/work/xarray/xarray/xarray/tests/test_dataset.py:359: AssertionError
Check warning on line 0 in xarray.tests.test_dataset.TestDataset
github-actions / Test Results
All 12 runs failed: test_unicode_data (xarray.tests.test_dataset.TestDataset)
artifacts/Test results for Linux-3.10 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 bare-minimum/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
AssertionError: assert '<xarray.Data... å: ∑' == '<xarray.Data... å: ∑'
- <xarray.Dataset> Size: 12B
? ----------
+ <xarray.Dataset>
Dimensions: (foø: 1)
Coordinates:
- * foø (foø) <U3 12B 'ba®'
? ----
+ * foø (foø) <U3 'ba®'
Data variables:
*empty*
Attributes:
å: ∑
self = <xarray.tests.test_dataset.TestDataset object at 0x15ae63e20>
def test_unicode_data(self) -> None:
# regression test for GH834
data = Dataset({"foø": ["ba®"]}, attrs={"å": "∑"})
repr(data) # should not raise
byteorder = "<" if sys.byteorder == "little" else ">"
expected = dedent(
"""\
<xarray.Dataset>
Dimensions: (foø: 1)
Coordinates:
* foø (foø) %cU3 %r
Data variables:
*empty*
Attributes:
å: ∑"""
% (byteorder, "ba®")
)
actual = str(data)
> assert expected == actual
E AssertionError: assert '<xarray.Data... å: ∑' == '<xarray.Data... å: ∑'
E
E - <xarray.Dataset> Size: 12B
E ? ----------
E + <xarray.Dataset>
E Dimensions: (foø: 1)
E Coordinates:
E - * foø (foø) <U3 12B 'ba®'
E ? ----
E + * foø (foø) <U3 'ba®'
E Data variables:
E *empty*
E Attributes:
E å: ∑
/Users/runner/work/xarray/xarray/xarray/tests/test_dataset.py:408: AssertionError
Check warning on line 0 in xarray.tests.test_dataset.TestDataset
github-actions / Test Results
All 12 runs failed: test_repr_nep18 (xarray.tests.test_dataset.TestDataset)
artifacts/Test results for Linux-3.10 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 bare-minimum/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
AssertionError: assert '<xarray.Data... Custom Array' == '<xarray.Data... Custom Array'
- <xarray.Dataset> Size: 16B
? ----------
+ <xarray.Dataset>
Dimensions: (x: 2)
Dimensions without coordinates: x
Data variables:
- foo (x) float64 16B Custom Array
? ----
+ foo (x) float64 Custom Array
self = <xarray.tests.test_dataset.TestDataset object at 0x15ae63d00>
def test_repr_nep18(self) -> None:
class Array:
def __init__(self):
self.shape = (2,)
self.ndim = 1
self.dtype = np.dtype(np.float64)
def __array_function__(self, *args, **kwargs):
return NotImplemented
def __array_ufunc__(self, *args, **kwargs):
return NotImplemented
def __repr__(self):
return "Custom\nArray"
dataset = Dataset({"foo": ("x", Array())})
expected = dedent(
"""\
<xarray.Dataset>
Dimensions: (x: 2)
Dimensions without coordinates: x
Data variables:
foo (x) float64 Custom Array"""
)
> assert expected == repr(dataset)
E AssertionError: assert '<xarray.Data... Custom Array' == '<xarray.Data... Custom Array'
E
E - <xarray.Dataset> Size: 16B
E ? ----------
E + <xarray.Dataset>
E Dimensions: (x: 2)
E Dimensions without coordinates: x
E Data variables:
E - foo (x) float64 16B Custom Array
E ? ----
E + foo (x) float64 Custom Array
/Users/runner/work/xarray/xarray/xarray/tests/test_dataset.py:435: AssertionError
Check warning on line 0 in xarray.tests.test_dask.TestVariable
github-actions / Test Results
All 10 runs failed: test_repr (xarray.tests.test_dask.TestVariable)
artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
AssertionError: assert '<xarray.Vari...umpy.ndarray>' == '<xarray.Vari...umpy.ndarray>'
- <xarray.Variable (x: 4, y: 6)> Size: 192B
? -----------
+ <xarray.Variable (x: 4, y: 6)>
dask.array<array, shape=(4, 6), dtype=float64, chunksize=(2, 2), chunktype=numpy.ndarray>
self = <xarray.tests.test_dask.TestVariable object at 0x15be7f2e0>
def test_repr(self):
expected = dedent(
f"""\
<xarray.Variable (x: 4, y: 6)>
{self.lazy_var.data!r}"""
)
> assert expected == repr(self.lazy_var)
E AssertionError: assert '<xarray.Vari...umpy.ndarray>' == '<xarray.Vari...umpy.ndarray>'
E
E - <xarray.Variable (x: 4, y: 6)> Size: 192B
E ? -----------
E + <xarray.Variable (x: 4, y: 6)>
E dask.array<array, shape=(4, 6), dtype=float64, chunksize=(2, 2), chunktype=numpy.ndarray>
/Users/runner/work/xarray/xarray/xarray/tests/test_dask.py:200: AssertionError
Check warning on line 0 in xarray.tests.test_formatting.TestFormatting
github-actions / Test Results
All 12 runs failed: test_diff_array_repr (xarray.tests.test_formatting.TestFormatting)
artifacts/Test results for Linux-3.10 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 bare-minimum/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
AssertionError: assert 'Left and rig...ription: desc' == 'Left and rig...ription: desc'
Skipping 219 identical leading characters in diff, use -v to show
- (x) <U1 8B 'a' 'b'
? -- -
+ (x) <U1 8B 'a' 'b'
- R * x (x) <U1 8B 'a' 'c'
? -- -
+ R * x (x) <U1 8B 'a' 'c'
Coordinates only on the left object:
- * y (y) int64 24B 1 2 3
? - -
+ * y (y) int64 24B 1 2 3
Coordinates only on the right object:
- label (x) int64 16B 1 2
? - -
+ label (x) int64 16B 1 2
Differing attributes:
L units: m
R units: kg
Attributes only on the left object:
description: desc
self = <xarray.tests.test_formatting.TestFormatting object at 0x15af8b910>
def test_diff_array_repr(self) -> None:
da_a = xr.DataArray(
np.array([[1, 2, 3], [4, 5, 6]], dtype="int64"),
dims=("x", "y"),
coords={
"x": np.array(["a", "b"], dtype="U1"),
"y": np.array([1, 2, 3], dtype="int64"),
},
attrs={"units": "m", "description": "desc"},
)
da_b = xr.DataArray(
np.array([1, 2], dtype="int64"),
dims="x",
coords={
"x": np.array(["a", "c"], dtype="U1"),
"label": ("x", np.array([1, 2], dtype="int64")),
},
attrs={"units": "kg"},
)
byteorder = "<" if sys.byteorder == "little" else ">"
expected = dedent(
"""\
Left and right DataArray objects are not identical
Differing dimensions:
(x: 2, y: 3) != (x: 2)
Differing values:
L
array([[1, 2, 3],
[4, 5, 6]], dtype=int64)
R
array([1, 2], dtype=int64)
Differing coordinates:
L * x (x) %cU1 8B 'a' 'b'
R * x (x) %cU1 8B 'a' 'c'
Coordinates only on the left object:
* y (y) int64 24B 1 2 3
Coordinates only on the right object:
label (x) int64 16B 1 2
Differing attributes:
L units: m
R units: kg
Attributes only on the left object:
description: desc"""
% (byteorder, byteorder)
)
actual = formatting.diff_array_repr(da_a, da_b, "identical")
try:
> assert actual == expected
E AssertionError: assert 'Left and rig...ription: desc' == 'Left and rig...ription: desc'
E
E Skipping 153 identical leading characters in diff, use -v to show
E - [4, 5, 6]], dtype=int64)
E + [4, 5, 6]])
E R
E - array([1, 2], dtype=int64)
E + array([1, 2])
E Differing coordinates:
E - L * x (x) <U1 8B 'a' 'b'
E ? -- -
E + L * x (x) <U1 8B 'a' 'b'
E - R * x (x) <U1 8B 'a' 'c'
E ? -- -
E + R * x (x) <U1 8B 'a' 'c'
E Coordinates only on the left object:
E - * y (y) int64 24B 1 2 3
E ? - -
E + * y (y) int64 24B 1 2 3
E Coordinates only on the right object:
E - label (x) int64 16B 1 2
E ? - -
E + label (x) int64 16B 1 2
E Differing attributes:
E L units: m
E R units: kg
E Attributes only on the left object:
E description: desc
/Users/runner/work/xarray/xarray/xarray/tests/test_formatting.py:335: AssertionError
During handling of the above exception, another exception occurred:
self = <xarray.tests.test_formatting.TestFormatting object at 0x15af8b910>
def test_diff_array_repr(self) -> None:
da_a = xr.DataArray(
np.array([[1, 2, 3], [4, 5, 6]], dtype="int64"),
dims=("x", "y"),
coords={
"x": np.array(["a", "b"], dtype="U1"),
"y": np.array([1, 2, 3], dtype="int64"),
},
attrs={"units": "m", "description": "desc"},
)
da_b = xr.DataArray(
np.array([1, 2], dtype="int64"),
dims="x",
coords={
"x": np.array(["a", "c"], dtype="U1"),
"label": ("x", np.array([1, 2], dtype="int64")),
},
attrs={"units": "kg"},
)
byteorder = "<" if sys.byteorder == "little" else ">"
expected = dedent(
"""\
Left and right DataArray objects are not identical
Differing dimensions:
(x: 2, y: 3) != (x: 2)
Differing values:
L
array([[1, 2, 3],
[4, 5, 6]], dtype=int64)
R
array([1, 2], dtype=int64)
Differing coordinates:
L * x (x) %cU1 8B 'a' 'b'
R * x (x) %cU1 8B 'a' 'c'
Coordinates only on the left object:
* y (y) int64 24B 1 2 3
Coordinates only on the right object:
label (x) int64 16B 1 2
Differing attributes:
L units: m
R units: kg
Attributes only on the left object:
description: desc"""
% (byteorder, byteorder)
)
actual = formatting.diff_array_repr(da_a, da_b, "identical")
try:
assert actual == expected
except AssertionError:
# depending on platform, dtype may not be shown in numpy array repr
> assert actual == expected.replace(", dtype=int64", "")
E AssertionError: assert 'Left and rig...ription: desc' == 'Left and rig...ription: desc'
E
E Skipping 219 identical leading characters in diff, use -v to show
E - (x) <U1 8B 'a' 'b'
E ? -- -
E + (x) <U1 8B 'a' 'b'
E - R * x (x) <U1 8B 'a' 'c'
E ? -- -
E + R * x (x) <U1 8B 'a' 'c'
E Coordinates only on the left object:
E - * y (y) int64 24B 1 2 3
E ? - -
E + * y (y) int64 24B 1 2 3
E Coordinates only on the right object:
E - label (x) int64 16B 1 2
E ? - -
E + label (x) int64 16B 1 2
E Differing attributes:
E L units: m
E R units: kg
E Attributes only on the left object:
E description: desc
/Users/runner/work/xarray/xarray/xarray/tests/test_formatting.py:338: AssertionError
Check warning on line 0 in xarray.tests.test_formatting.TestFormatting
github-actions / Test Results
All 12 runs failed: test_diff_dataset_repr (xarray.tests.test_formatting.TestFormatting)
artifacts/Test results for Linux-3.10 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 bare-minimum/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
AssertionError: assert 'Left and rig...ription: desc' == 'Left and rig...ription: desc'
Skipping 132 identical leading characters in diff, use -v to show
- (x) <U1 8B 'a' 'b'
? -- -
+ (x) <U1 8B 'a' 'b'
Differing variable attributes:
foo: bar
- R * x (x) <U1 8B 'a' 'c'
? -- -
+ R * x (x) <U1 8B 'a' 'c'
Differing variable attributes:
source: 0
foo: baz
Coordinates only on the left object:
- * y (y) int64 24B 1 2 3
? - -
+ * y (y) int64 24B 1 2 3
Coordinates only on the right object:
- label (x) int64 16B 1 2
? - -
+ label (x) int64 16B 1 2
Differing data variables:
- L var1 (x, y) int64 48B 1 2 3 4 5 6
? - -
+ L var1 (x, y) int64 48B 1 2 3 4 5 6
- R var1 (x) int64 16B 1 2
? - -
+ R var1 (x) int64 16B 1 2
Data variables only on the left object:
- var2 (x) int64 16B 3 4
? - -
+ var2 (x) int64 16B 3 4
Differing attributes:
L title: mytitle
R title: newtitle
Attributes only on the left object:
description: desc
self = <xarray.tests.test_formatting.TestFormatting object at 0x15af65670>
def test_diff_dataset_repr(self) -> None:
ds_a = xr.Dataset(
data_vars={
"var1": (("x", "y"), np.array([[1, 2, 3], [4, 5, 6]], dtype="int64")),
"var2": ("x", np.array([3, 4], dtype="int64")),
},
coords={
"x": (
"x",
np.array(["a", "b"], dtype="U1"),
{"foo": "bar", "same": "same"},
),
"y": np.array([1, 2, 3], dtype="int64"),
},
attrs={"title": "mytitle", "description": "desc"},
)
ds_b = xr.Dataset(
data_vars={"var1": ("x", np.array([1, 2], dtype="int64"))},
coords={
"x": (
"x",
np.array(["a", "c"], dtype="U1"),
{"source": 0, "foo": "baz", "same": "same"},
),
"label": ("x", np.array([1, 2], dtype="int64")),
},
attrs={"title": "newtitle"},
)
byteorder = "<" if sys.byteorder == "little" else ">"
expected = dedent(
"""\
Left and right Dataset objects are not identical
Differing dimensions:
(x: 2, y: 3) != (x: 2)
Differing coordinates:
L * x (x) %cU1 8B 'a' 'b'
Differing variable attributes:
foo: bar
R * x (x) %cU1 8B 'a' 'c'
Differing variable attributes:
source: 0
foo: baz
Coordinates only on the left object:
* y (y) int64 24B 1 2 3
Coordinates only on the right object:
label (x) int64 16B 1 2
Differing data variables:
L var1 (x, y) int64 48B 1 2 3 4 5 6
R var1 (x) int64 16B 1 2
Data variables only on the left object:
var2 (x) int64 16B 3 4
Differing attributes:
L title: mytitle
R title: newtitle
Attributes only on the left object:
description: desc"""
% (byteorder, byteorder)
)
actual = formatting.diff_dataset_repr(ds_a, ds_b, "identical")
> assert actual == expected
E AssertionError: assert 'Left and rig...ription: desc' == 'Left and rig...ription: desc'
E
E Skipping 132 identical leading characters in diff, use -v to show
E - (x) <U1 8B 'a' 'b'
E ? -- -
E + (x) <U1 8B 'a' 'b'
E Differing variable attributes:
E foo: bar
E - R * x (x) <U1 8B 'a' 'c'
E ? -- -
E + R * x (x) <U1 8B 'a' 'c'
E Differing variable attributes:
E source: 0
E foo: baz
E Coordinates only on the left object:
E - * y (y) int64 24B 1 2 3
E ? - -
E + * y (y) int64 24B 1 2 3
E Coordinates only on the right object:
E - label (x) int64 16B 1 2
E ? - -
E + label (x) int64 16B 1 2
E Differing data variables:
E - L var1 (x, y) int64 48B 1 2 3 4 5 6
E ? - -
E + L var1 (x, y) int64 48B 1 2 3 4 5 6
E - R var1 (x) int64 16B 1 2
E ? - -
E + R var1 (x) int64 16B 1 2
E Data variables only on the left object:
E - var2 (x) int64 16B 3 4
E ? - -
E + var2 (x) int64 16B 3 4
E Differing attributes:
E L title: mytitle
E R title: newtitle
E Attributes only on the left object:
E description: desc
/Users/runner/work/xarray/xarray/xarray/tests/test_formatting.py:464: AssertionError
Check warning on line 0 in xarray.tests.test_formatting.TestFormatting
github-actions / Test Results
3 out of 12 runs failed: test_array_repr (xarray.tests.test_formatting.TestFormatting)
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
Raw output
AssertionError: assert '<xarray.Data...dinates: test' == '<xarray.Data...dinates: test'
Skipping 40 identical trailing characters in diff, use -v to show
- <xarray.DataArray (1, 2) (test: 1)> Size: 8B
? ^
+ <xarray.DataArray (1, 2) (test: 1)> Size: 4B
? ^
array([
self = <xarray.tests.test_formatting.TestFormatting object at 0x000002A6E9336640>
def test_array_repr(self) -> None:
ds = xr.Dataset(coords={"foo": [1, 2, 3], "bar": [1, 2, 3]})
ds[(1, 2)] = xr.DataArray([0], dims="test")
ds_12 = ds[(1, 2)]
# Test repr function behaves correctly:
actual = formatting.array_repr(ds_12)
expected = dedent(
"""\
<xarray.DataArray (1, 2) (test: 1)> Size: 8B
array([0])
Dimensions without coordinates: test"""
)
> assert actual == expected
E AssertionError: assert '<xarray.Data...dinates: test' == '<xarray.Data...dinates: test'
E
E Skipping 40 identical trailing characters in diff, use -v to show
E - <xarray.DataArray (1, 2) (test: 1)> Size: 8B
E ? ^
E + <xarray.DataArray (1, 2) (test: 1)> Size: 4B
E ? ^
E array([
D:\a\xarray\xarray\xarray\tests\test_formatting.py:480: AssertionError
Check warning on line 0 in xarray.tests.test_formatting
github-actions / Test Results
11 out of 12 runs failed: test_repr_file_collapsed (xarray.tests.test_formatting)
artifacts/Test results for Linux-3.10 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
AssertionError: assert '<xarray.Data...dinates: test' == '<xarray.Data...dinates: test'
- <xarray.DataArray (test: 300)>
+ <xarray.DataArray (test: 300)> Size: 2kB
? ++++++++++
[300 values with dtype=int64]
Dimensions without coordinates: test
tmp_path = PosixPath('/private/var/folders/kx/gw6dssyn19d9qjs9mvh4hkz80000gn/T/pytest-of-runner/pytest-0/popen-gw1/test_repr_file_collapsed0')
@requires_netCDF4
def test_repr_file_collapsed(tmp_path) -> None:
arr_to_store = xr.DataArray(np.arange(300, dtype=np.int64), dims="test")
arr_to_store.to_netcdf(tmp_path / "test.nc", engine="netcdf4")
with (
xr.open_dataarray(tmp_path / "test.nc") as arr,
xr.set_options(display_expand_data=False),
):
actual = repr(arr)
expected = dedent(
"""\
<xarray.DataArray (test: 300)>
[300 values with dtype=int64]
Dimensions without coordinates: test"""
)
> assert actual == expected
E AssertionError: assert '<xarray.Data...dinates: test' == '<xarray.Data...dinates: test'
E
E - <xarray.DataArray (test: 300)>
E + <xarray.DataArray (test: 300)> Size: 2kB
E ? ++++++++++
E [300 values with dtype=int64]
E Dimensions without coordinates: test
/Users/runner/work/xarray/xarray/xarray/tests/test_formatting.py:642: AssertionError
Check warning on line 0 in xarray.tests.test_formatting
github-actions / Test Results
All 12 runs failed: test__mapping_repr[50-40-30] (xarray.tests.test_formatting)
artifacts/Test results for Linux-3.10 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 bare-minimum/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.11/pytest.xml [took 1s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
AssertionError: assert '<xarray.Data...ributes: (30)' == '<xarray.Data...ributes: (30)'
- <xarray.Dataset>
+ <xarray.Dataset> Size: 1kB
? ++++++++++
Dimensions: (coord0: 2, coord1: 2, coord2: 2, coord3: 2, coord4: 2,
coord5: 2, coord6: 2, coord7: 2, coord8: 2, coord9: 2,
coord10: 2, coord11: 2, coord12: 2, coord13: 2, coord14: 2,
coord15: 2, coord16: 2, coord17: 2, coord18: 2, coord19: 2,
coord20: 2, coord21: 2, coord22: 2, coord23: 2, coord24: 2,
coord25: 2, coord26: 2, coord27: 2, coord28: 2, coord29: 2,
coord30: 2, coord31: 2, coord32: 2, coord33: 2, coord34: 2,
coord35: 2, coord36: 2, coord37: 2, coord38: 2, coord39: 2)
Coordinates: (40)
Data variables: (40)
Attributes: (30)
display_max_rows = 50, n_vars = 40, n_attr = 30
@pytest.mark.parametrize(
"display_max_rows, n_vars, n_attr",
[(50, 40, 30), (35, 40, 30), (11, 40, 30), (1, 40, 30)],
)
def test__mapping_repr(display_max_rows, n_vars, n_attr) -> None:
long_name = "long_name"
a = defchararray.add(long_name, np.arange(0, n_vars).astype(str))
b = defchararray.add("attr_", np.arange(0, n_attr).astype(str))
c = defchararray.add("coord", np.arange(0, n_vars).astype(str))
attrs = {k: 2 for k in b}
coords = {_c: np.array([0, 1]) for _c in c}
data_vars = dict()
for v, _c in zip(a, coords.items()):
data_vars[v] = xr.DataArray(
name=v,
data=np.array([3, 4]),
dims=[_c[0]],
coords=dict([_c]),
)
ds = xr.Dataset(data_vars)
ds.attrs = attrs
with xr.set_options(display_max_rows=display_max_rows):
# Parse the data_vars print and show only data_vars rows:
summary = formatting.dataset_repr(ds).split("\n")
summary = [v for v in summary if long_name in v]
# The length should be less than or equal to display_max_rows:
len_summary = len(summary)
data_vars_print_size = min(display_max_rows, len_summary)
assert len_summary == data_vars_print_size
summary = formatting.data_vars_repr(ds.data_vars).split("\n")
summary = [v for v in summary if long_name in v]
# The length should be equal to the number of data variables
len_summary = len(summary)
assert len_summary == n_vars
summary = formatting.coords_repr(ds.coords).split("\n")
summary = [v for v in summary if "coord" in v]
# The length should be equal to the number of data variables
len_summary = len(summary)
assert len_summary == n_vars
with xr.set_options(
display_max_rows=display_max_rows,
display_expand_coords=False,
display_expand_data_vars=False,
display_expand_attrs=False,
):
actual = formatting.dataset_repr(ds)
col_width = formatting._calculate_col_width(ds.variables)
dims_start = formatting.pretty_print("Dimensions:", col_width)
dims_values = formatting.dim_summary_limited(
ds, col_width=col_width + 1, max_rows=display_max_rows
)
expected = f"""\
<xarray.Dataset>
{dims_start}({dims_values})
Coordinates: ({n_vars})
Data variables: ({n_vars})
Attributes: ({n_attr})"""
expected = dedent(expected)
> assert actual == expected
E AssertionError: assert '<xarray.Data...ributes: (30)' == '<xarray.Data...ributes: (30)'
E
E - <xarray.Dataset>
E + <xarray.Dataset> Size: 1kB
E ? ++++++++++
E Dimensions: (coord0: 2, coord1: 2, coord2: 2, coord3: 2, coord4: 2,
E coord5: 2, coord6: 2, coord7: 2, coord8: 2, coord9: 2,
E coord10: 2, coord11: 2, coord12: 2, coord13: 2, coord14: 2,
E coord15: 2, coord16: 2, coord17: 2, coord18: 2, coord19: 2,
E coord20: 2, coord21: 2, coord22: 2, coord23: 2, coord24: 2,
E coord25: 2, coord26: 2, coord27: 2, coord28: 2, coord29: 2,
E coord30: 2, coord31: 2, coord32: 2, coord33: 2, coord34: 2,
E coord35: 2, coord36: 2, coord37: 2, coord38: 2, coord39: 2)
E Coordinates: (40)
E Data variables: (40)
E Attributes: (30)
/Users/runner/work/xarray/xarray/xarray/tests/test_formatting.py:718: AssertionError
Check warning on line 0 in xarray.tests.test_formatting
github-actions / Test Results
All 12 runs failed: test__mapping_repr[35-40-30] (xarray.tests.test_formatting)
artifacts/Test results for Linux-3.10 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 bare-minimum/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.11/pytest.xml [took 1s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
AssertionError: assert '<xarray.Data...ributes: (30)' == '<xarray.Data...ributes: (30)'
- <xarray.Dataset>
+ <xarray.Dataset> Size: 1kB
? ++++++++++
Dimensions: (coord0: 2, coord1: 2, coord2: 2, coord3: 2, coord4: 2,
coord5: 2, coord6: 2, coord7: 2, coord8: 2, coord9: 2,
coord10: 2, coord11: 2, coord12: 2, coord13: 2, coord14: 2,
coord15: 2, coord16: 2, coord17: 2, coord18: 2, coord19: 2,
coord20: 2, coord21: 2, coord22: 2, coord23: 2, coord24: 2,
coord25: 2, coord26: 2, coord27: 2, coord28: 2, coord29: 2,
coord30: 2, coord31: 2, coord32: 2, coord33: 2, coord34: 2,
coord35: 2, coord36: 2, coord37: 2, coord38: 2, coord39: 2)
Coordinates: (40)
Data variables: (40)
Attributes: (30)
display_max_rows = 35, n_vars = 40, n_attr = 30
@pytest.mark.parametrize(
"display_max_rows, n_vars, n_attr",
[(50, 40, 30), (35, 40, 30), (11, 40, 30), (1, 40, 30)],
)
def test__mapping_repr(display_max_rows, n_vars, n_attr) -> None:
long_name = "long_name"
a = defchararray.add(long_name, np.arange(0, n_vars).astype(str))
b = defchararray.add("attr_", np.arange(0, n_attr).astype(str))
c = defchararray.add("coord", np.arange(0, n_vars).astype(str))
attrs = {k: 2 for k in b}
coords = {_c: np.array([0, 1]) for _c in c}
data_vars = dict()
for v, _c in zip(a, coords.items()):
data_vars[v] = xr.DataArray(
name=v,
data=np.array([3, 4]),
dims=[_c[0]],
coords=dict([_c]),
)
ds = xr.Dataset(data_vars)
ds.attrs = attrs
with xr.set_options(display_max_rows=display_max_rows):
# Parse the data_vars print and show only data_vars rows:
summary = formatting.dataset_repr(ds).split("\n")
summary = [v for v in summary if long_name in v]
# The length should be less than or equal to display_max_rows:
len_summary = len(summary)
data_vars_print_size = min(display_max_rows, len_summary)
assert len_summary == data_vars_print_size
summary = formatting.data_vars_repr(ds.data_vars).split("\n")
summary = [v for v in summary if long_name in v]
# The length should be equal to the number of data variables
len_summary = len(summary)
assert len_summary == n_vars
summary = formatting.coords_repr(ds.coords).split("\n")
summary = [v for v in summary if "coord" in v]
# The length should be equal to the number of data variables
len_summary = len(summary)
assert len_summary == n_vars
with xr.set_options(
display_max_rows=display_max_rows,
display_expand_coords=False,
display_expand_data_vars=False,
display_expand_attrs=False,
):
actual = formatting.dataset_repr(ds)
col_width = formatting._calculate_col_width(ds.variables)
dims_start = formatting.pretty_print("Dimensions:", col_width)
dims_values = formatting.dim_summary_limited(
ds, col_width=col_width + 1, max_rows=display_max_rows
)
expected = f"""\
<xarray.Dataset>
{dims_start}({dims_values})
Coordinates: ({n_vars})
Data variables: ({n_vars})
Attributes: ({n_attr})"""
expected = dedent(expected)
> assert actual == expected
E AssertionError: assert '<xarray.Data...ributes: (30)' == '<xarray.Data...ributes: (30)'
E
E - <xarray.Dataset>
E + <xarray.Dataset> Size: 1kB
E ? ++++++++++
E Dimensions: (coord0: 2, coord1: 2, coord2: 2, coord3: 2, coord4: 2,
E coord5: 2, coord6: 2, coord7: 2, coord8: 2, coord9: 2,
E coord10: 2, coord11: 2, coord12: 2, coord13: 2, coord14: 2,
E coord15: 2, coord16: 2, coord17: 2, coord18: 2, coord19: 2,
E coord20: 2, coord21: 2, coord22: 2, coord23: 2, coord24: 2,
E coord25: 2, coord26: 2, coord27: 2, coord28: 2, coord29: 2,
E coord30: 2, coord31: 2, coord32: 2, coord33: 2, coord34: 2,
E coord35: 2, coord36: 2, coord37: 2, coord38: 2, coord39: 2)
E Coordinates: (40)
E Data variables: (40)
E Attributes: (30)
/Users/runner/work/xarray/xarray/xarray/tests/test_formatting.py:718: AssertionError
Check warning on line 0 in xarray.tests.test_dask.TestDataArrayAndDataset
github-actions / Test Results
All 10 runs failed: test_dataarray_repr (xarray.tests.test_dask.TestDataArrayAndDataset)
artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
AssertionError: assert '<xarray.Data...oordinates: x' == '<xarray.Data...oordinates: x'
- <xarray.DataArray 'data' (x: 1)> Size: 8B
? ---------
+ <xarray.DataArray 'data' (x: 1)>
dask.array<data, shape=(1,), dtype=int64, chunksize=(1,), chunktype=numpy.ndarray>
Coordinates:
- y (x) int64 8B dask.array<chunksize=(1,), meta=np.ndarray>
? ---
+ y (x) int64 dask.array<chunksize=(1,), meta=np.ndarray>
Dimensions without coordinates: x
self = <xarray.tests.test_dask.TestDataArrayAndDataset object at 0x15be98820>
def test_dataarray_repr(self):
data = build_dask_array("data")
nonindex_coord = build_dask_array("coord")
a = DataArray(data, dims=["x"], coords={"y": ("x", nonindex_coord)})
expected = dedent(
f"""\
<xarray.DataArray 'data' (x: 1)>
{data!r}
Coordinates:
y (x) int64 dask.array<chunksize=(1,), meta=np.ndarray>
Dimensions without coordinates: x"""
)
> assert expected == repr(a)
E AssertionError: assert '<xarray.Data...oordinates: x' == '<xarray.Data...oordinates: x'
E
E - <xarray.DataArray 'data' (x: 1)> Size: 8B
E ? ---------
E + <xarray.DataArray 'data' (x: 1)>
E dask.array<data, shape=(1,), dtype=int64, chunksize=(1,), chunktype=numpy.ndarray>
E Coordinates:
E - y (x) int64 8B dask.array<chunksize=(1,), meta=np.ndarray>
E ? ---
E + y (x) int64 dask.array<chunksize=(1,), meta=np.ndarray>
E Dimensions without coordinates: x
/Users/runner/work/xarray/xarray/xarray/tests/test_dask.py:675: AssertionError
Check warning on line 0 in xarray.tests.test_formatting
github-actions / Test Results
All 12 runs failed: test__mapping_repr[11-40-30] (xarray.tests.test_formatting)
artifacts/Test results for Linux-3.10 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 bare-minimum/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
AssertionError: assert '<xarray.Data...ributes: (30)' == '<xarray.Data...ributes: (30)'
- <xarray.Dataset>
+ <xarray.Dataset> Size: 1kB
? ++++++++++
Dimensions: (coord0: 2, coord1: 2, coord2: 2, coord3: 2, coord4: 2,
coord5: 2, coord6: 2, coord7: 2, coord8: 2, coord9: 2,
coord10: 2, coord11: 2, coord12: 2, coord13: 2, coord14: 2,
coord15: 2, coord16: 2, coord17: 2, coord18: 2, coord19: 2,
coord20: 2, coord21: 2, coord22: 2, coord23: 2, coord24: 2,
coord25: 2, coord26: 2, coord27: 2, coord28: 2, coord29: 2,
coord30: 2, coord31: 2, coord32: 2, coord33: 2, coord34: 2,
coord35: 2, coord36: 2, coord37: 2, coord38: 2, coord39: 2)
Coordinates: (40)
Data variables: (40)
Attributes: (30)
display_max_rows = 11, n_vars = 40, n_attr = 30
@pytest.mark.parametrize(
"display_max_rows, n_vars, n_attr",
[(50, 40, 30), (35, 40, 30), (11, 40, 30), (1, 40, 30)],
)
def test__mapping_repr(display_max_rows, n_vars, n_attr) -> None:
long_name = "long_name"
a = defchararray.add(long_name, np.arange(0, n_vars).astype(str))
b = defchararray.add("attr_", np.arange(0, n_attr).astype(str))
c = defchararray.add("coord", np.arange(0, n_vars).astype(str))
attrs = {k: 2 for k in b}
coords = {_c: np.array([0, 1]) for _c in c}
data_vars = dict()
for v, _c in zip(a, coords.items()):
data_vars[v] = xr.DataArray(
name=v,
data=np.array([3, 4]),
dims=[_c[0]],
coords=dict([_c]),
)
ds = xr.Dataset(data_vars)
ds.attrs = attrs
with xr.set_options(display_max_rows=display_max_rows):
# Parse the data_vars print and show only data_vars rows:
summary = formatting.dataset_repr(ds).split("\n")
summary = [v for v in summary if long_name in v]
# The length should be less than or equal to display_max_rows:
len_summary = len(summary)
data_vars_print_size = min(display_max_rows, len_summary)
assert len_summary == data_vars_print_size
summary = formatting.data_vars_repr(ds.data_vars).split("\n")
summary = [v for v in summary if long_name in v]
# The length should be equal to the number of data variables
len_summary = len(summary)
assert len_summary == n_vars
summary = formatting.coords_repr(ds.coords).split("\n")
summary = [v for v in summary if "coord" in v]
# The length should be equal to the number of data variables
len_summary = len(summary)
assert len_summary == n_vars
with xr.set_options(
display_max_rows=display_max_rows,
display_expand_coords=False,
display_expand_data_vars=False,
display_expand_attrs=False,
):
actual = formatting.dataset_repr(ds)
col_width = formatting._calculate_col_width(ds.variables)
dims_start = formatting.pretty_print("Dimensions:", col_width)
dims_values = formatting.dim_summary_limited(
ds, col_width=col_width + 1, max_rows=display_max_rows
)
expected = f"""\
<xarray.Dataset>
{dims_start}({dims_values})
Coordinates: ({n_vars})
Data variables: ({n_vars})
Attributes: ({n_attr})"""
expected = dedent(expected)
> assert actual == expected
E AssertionError: assert '<xarray.Data...ributes: (30)' == '<xarray.Data...ributes: (30)'
E
E - <xarray.Dataset>
E + <xarray.Dataset> Size: 1kB
E ? ++++++++++
E Dimensions: (coord0: 2, coord1: 2, coord2: 2, coord3: 2, coord4: 2,
E coord5: 2, coord6: 2, coord7: 2, coord8: 2, coord9: 2,
E coord10: 2, coord11: 2, coord12: 2, coord13: 2, coord14: 2,
E coord15: 2, coord16: 2, coord17: 2, coord18: 2, coord19: 2,
E coord20: 2, coord21: 2, coord22: 2, coord23: 2, coord24: 2,
E coord25: 2, coord26: 2, coord27: 2, coord28: 2, coord29: 2,
E coord30: 2, coord31: 2, coord32: 2, coord33: 2, coord34: 2,
E coord35: 2, coord36: 2, coord37: 2, coord38: 2, coord39: 2)
E Coordinates: (40)
E Data variables: (40)
E Attributes: (30)
/Users/runner/work/xarray/xarray/xarray/tests/test_formatting.py:718: AssertionError
Check warning on line 0 in xarray.tests.test_dask.TestDataArrayAndDataset
github-actions / Test Results
All 10 runs failed: test_dataset_repr (xarray.tests.test_dask.TestDataArrayAndDataset)
artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
AssertionError: assert '<xarray.Data...a=np.ndarray>' == '<xarray.Data...a=np.ndarray>'
- <xarray.Dataset> Size: 16B
? ----------
+ <xarray.Dataset>
Dimensions: (x: 1)
Coordinates:
- y (x) int64 8B dask.array<chunksize=(1,), meta=np.ndarray>
? ---
+ y (x) int64 dask.array<chunksize=(1,), meta=np.ndarray>
Dimensions without coordinates: x
Data variables:
- a (x) int64 8B dask.array<chunksize=(1,), meta=np.ndarray>
? ---
+ a (x) int64 dask.array<chunksize=(1,), meta=np.ndarray>
self = <xarray.tests.test_dask.TestDataArrayAndDataset object at 0x15be98ac0>
def test_dataset_repr(self):
data = build_dask_array("data")
nonindex_coord = build_dask_array("coord")
ds = Dataset(data_vars={"a": ("x", data)}, coords={"y": ("x", nonindex_coord)})
expected = dedent(
"""\
<xarray.Dataset>
Dimensions: (x: 1)
Coordinates:
y (x) int64 dask.array<chunksize=(1,), meta=np.ndarray>
Dimensions without coordinates: x
Data variables:
a (x) int64 dask.array<chunksize=(1,), meta=np.ndarray>"""
)
> assert expected == repr(ds)
E AssertionError: assert '<xarray.Data...a=np.ndarray>' == '<xarray.Data...a=np.ndarray>'
E
E - <xarray.Dataset> Size: 16B
E ? ----------
E + <xarray.Dataset>
E Dimensions: (x: 1)
E Coordinates:
E - y (x) int64 8B dask.array<chunksize=(1,), meta=np.ndarray>
E ? ---
E + y (x) int64 dask.array<chunksize=(1,), meta=np.ndarray>
E Dimensions without coordinates: x
E Data variables:
E - a (x) int64 8B dask.array<chunksize=(1,), meta=np.ndarray>
E ? ---
E + a (x) int64 dask.array<chunksize=(1,), meta=np.ndarray>
/Users/runner/work/xarray/xarray/xarray/tests/test_dask.py:692: AssertionError
Check warning on line 0 in xarray.tests.test_formatting
github-actions / Test Results
All 12 runs failed: test__mapping_repr[1-40-30] (xarray.tests.test_formatting)
artifacts/Test results for Linux-3.10 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 bare-minimum/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
AssertionError: assert '<xarray.Data...ributes: (30)' == '<xarray.Data...ributes: (30)'
- <xarray.Dataset>
+ <xarray.Dataset> Size: 1kB
? ++++++++++
Dimensions: (coord0: 2, coord1: 2, coord2: 2, coord3: 2, coord4: 2,
...)
Coordinates: (40)
Data variables: (40)
Attributes: (30)
display_max_rows = 1, n_vars = 40, n_attr = 30
@pytest.mark.parametrize(
"display_max_rows, n_vars, n_attr",
[(50, 40, 30), (35, 40, 30), (11, 40, 30), (1, 40, 30)],
)
def test__mapping_repr(display_max_rows, n_vars, n_attr) -> None:
long_name = "long_name"
a = defchararray.add(long_name, np.arange(0, n_vars).astype(str))
b = defchararray.add("attr_", np.arange(0, n_attr).astype(str))
c = defchararray.add("coord", np.arange(0, n_vars).astype(str))
attrs = {k: 2 for k in b}
coords = {_c: np.array([0, 1]) for _c in c}
data_vars = dict()
for v, _c in zip(a, coords.items()):
data_vars[v] = xr.DataArray(
name=v,
data=np.array([3, 4]),
dims=[_c[0]],
coords=dict([_c]),
)
ds = xr.Dataset(data_vars)
ds.attrs = attrs
with xr.set_options(display_max_rows=display_max_rows):
# Parse the data_vars print and show only data_vars rows:
summary = formatting.dataset_repr(ds).split("\n")
summary = [v for v in summary if long_name in v]
# The length should be less than or equal to display_max_rows:
len_summary = len(summary)
data_vars_print_size = min(display_max_rows, len_summary)
assert len_summary == data_vars_print_size
summary = formatting.data_vars_repr(ds.data_vars).split("\n")
summary = [v for v in summary if long_name in v]
# The length should be equal to the number of data variables
len_summary = len(summary)
assert len_summary == n_vars
summary = formatting.coords_repr(ds.coords).split("\n")
summary = [v for v in summary if "coord" in v]
# The length should be equal to the number of data variables
len_summary = len(summary)
assert len_summary == n_vars
with xr.set_options(
display_max_rows=display_max_rows,
display_expand_coords=False,
display_expand_data_vars=False,
display_expand_attrs=False,
):
actual = formatting.dataset_repr(ds)
col_width = formatting._calculate_col_width(ds.variables)
dims_start = formatting.pretty_print("Dimensions:", col_width)
dims_values = formatting.dim_summary_limited(
ds, col_width=col_width + 1, max_rows=display_max_rows
)
expected = f"""\
<xarray.Dataset>
{dims_start}({dims_values})
Coordinates: ({n_vars})
Data variables: ({n_vars})
Attributes: ({n_attr})"""
expected = dedent(expected)
> assert actual == expected
E AssertionError: assert '<xarray.Data...ributes: (30)' == '<xarray.Data...ributes: (30)'
E
E - <xarray.Dataset>
E + <xarray.Dataset> Size: 1kB
E ? ++++++++++
E Dimensions: (coord0: 2, coord1: 2, coord2: 2, coord3: 2, coord4: 2,
E ...)
E Coordinates: (40)
E Data variables: (40)
E Attributes: (30)
/Users/runner/work/xarray/xarray/xarray/tests/test_formatting.py:718: AssertionError
Check warning on line 0 in xarray.tests.test_sparse.TestSparseVariable
github-actions / Test Results
All 9 runs failed: test_repr (xarray.tests.test_sparse.TestSparseVariable)
artifacts/Test results for Linux-3.10 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
AssertionError: assert '<xarray.Vari...ll_value=0.0>' == '<xarray.Vari...ll_value=0.0>'
- <xarray.Variable (x: 4, y: 6)> Size: 288B
? -----------
+ <xarray.Variable (x: 4, y: 6)>
<COO: shape=(4, 6), dtype=float64, nnz=12, fill_value=0.0>
self = <xarray.tests.test_sparse.TestSparseVariable object at 0x15e550d60>
def test_repr(self):
expected = dedent(
"""\
<xarray.Variable (x: 4, y: 6)>
<COO: shape=(4, 6), dtype=float64, nnz=12, fill_value=0.0>"""
)
> assert expected == repr(self.var)
E AssertionError: assert '<xarray.Vari...ll_value=0.0>' == '<xarray.Vari...ll_value=0.0>'
E
E - <xarray.Variable (x: 4, y: 6)> Size: 288B
E ? -----------
E + <xarray.Variable (x: 4, y: 6)>
E <COO: shape=(4, 6), dtype=float64, nnz=12, fill_value=0.0>
/Users/runner/work/xarray/xarray/xarray/tests/test_sparse.py:303: AssertionError
Check warning on line 0 in xarray.tests.test_sparse.TestSparseDataArrayAndDataset
github-actions / Test Results
All 9 runs failed: test_dataarray_repr (xarray.tests.test_sparse.TestSparseDataArrayAndDataset)
artifacts/Test results for Linux-3.10 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
AssertionError: assert '<xarray.Data...oordinates: x' == '<xarray.Data...oordinates: x'
- <xarray.DataArray (x: 4)> Size: 64B
? ----------
+ <xarray.DataArray (x: 4)>
<COO: shape=(4,), dtype=float64, nnz=4, fill_value=0.0>
Coordinates:
- y (x) int64 48B <COO: nnz=3, fill_value=0>
? ----
+ y (x) int64 <COO: nnz=3, fill_value=0>
Dimensions without coordinates: x
self = <xarray.tests.test_sparse.TestSparseDataArrayAndDataset object at 0x155c92e20>
def test_dataarray_repr(self):
a = xr.DataArray(
sparse.COO.from_numpy(np.ones(4)),
dims=["x"],
coords={"y": ("x", sparse.COO.from_numpy(np.arange(4, dtype="i8")))},
)
expected = dedent(
"""\
<xarray.DataArray (x: 4)>
<COO: shape=(4,), dtype=float64, nnz=4, fill_value=0.0>
Coordinates:
y (x) int64 <COO: nnz=3, fill_value=0>
Dimensions without coordinates: x"""
)
> assert expected == repr(a)
E AssertionError: assert '<xarray.Data...oordinates: x' == '<xarray.Data...oordinates: x'
E
E - <xarray.DataArray (x: 4)> Size: 64B
E ? ----------
E + <xarray.DataArray (x: 4)>
E <COO: shape=(4,), dtype=float64, nnz=4, fill_value=0.0>
E Coordinates:
E - y (x) int64 48B <COO: nnz=3, fill_value=0>
E ? ----
E + y (x) int64 <COO: nnz=3, fill_value=0>
E Dimensions without coordinates: x
/Users/runner/work/xarray/xarray/xarray/tests/test_sparse.py:690: AssertionError
Check warning on line 0 in xarray.tests.test_sparse.TestSparseDataArrayAndDataset
github-actions / Test Results
All 9 runs failed: test_dataset_repr (xarray.tests.test_sparse.TestSparseDataArrayAndDataset)
artifacts/Test results for Linux-3.10 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
AssertionError: assert '<xarray.Data...ll_value=0.0>' == '<xarray.Data...ll_value=0.0>'
- <xarray.Dataset> Size: 112B
? -----------
+ <xarray.Dataset>
Dimensions: (x: 4)
Coordinates:
- y (x) int64 48B <COO: nnz=3, fill_value=0>
? ----
+ y (x) int64 <COO: nnz=3, fill_value=0>
Dimensions without coordinates: x
Data variables:
- a (x) float64 64B <COO: nnz=4, fill_value=0.0>
? ----
+ a (x) float64 <COO: nnz=4, fill_value=0.0>
self = <xarray.tests.test_sparse.TestSparseDataArrayAndDataset object at 0x155c99100>
def test_dataset_repr(self):
ds = xr.Dataset(
data_vars={"a": ("x", sparse.COO.from_numpy(np.ones(4)))},
coords={"y": ("x", sparse.COO.from_numpy(np.arange(4, dtype="i8")))},
)
expected = dedent(
"""\
<xarray.Dataset>
Dimensions: (x: 4)
Coordinates:
y (x) int64 <COO: nnz=3, fill_value=0>
Dimensions without coordinates: x
Data variables:
a (x) float64 <COO: nnz=4, fill_value=0.0>"""
)
> assert expected == repr(ds)
E AssertionError: assert '<xarray.Data...ll_value=0.0>' == '<xarray.Data...ll_value=0.0>'
E
E - <xarray.Dataset> Size: 112B
E ? -----------
E + <xarray.Dataset>
E Dimensions: (x: 4)
E Coordinates:
E - y (x) int64 48B <COO: nnz=3, fill_value=0>
E ? ----
E + y (x) int64 <COO: nnz=3, fill_value=0>
E Dimensions without coordinates: x
E Data variables:
E - a (x) float64 64B <COO: nnz=4, fill_value=0.0>
E ? ----
E + a (x) float64 <COO: nnz=4, fill_value=0.0>
/Users/runner/work/xarray/xarray/xarray/tests/test_sparse.py:707: AssertionError
Check warning on line 0 in xarray.tests.test_sparse.TestSparseDataArrayAndDataset
github-actions / Test Results
8 out of 9 runs failed: test_sparse_dask_dataset_repr (xarray.tests.test_sparse.TestSparseDataArrayAndDataset)
artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
AssertionError: assert '<xarray.Data...a=sparse.COO>' == '<xarray.Data...a=sparse.COO>'
- <xarray.Dataset> Size: 32B
? ----------
+ <xarray.Dataset>
Dimensions: (x: 4)
Dimensions without coordinates: x
Data variables:
- a (x) float64 32B dask.array<chunksize=(4,), meta=sparse.COO>
? ----
+ a (x) float64 dask.array<chunksize=(4,), meta=sparse.COO>
self = <xarray.tests.test_sparse.TestSparseDataArrayAndDataset object at 0x155c993a0>
@requires_dask
def test_sparse_dask_dataset_repr(self):
ds = xr.Dataset(
data_vars={"a": ("x", sparse.COO.from_numpy(np.ones(4)))}
).chunk()
expected = dedent(
"""\
<xarray.Dataset>
Dimensions: (x: 4)
Dimensions without coordinates: x
Data variables:
a (x) float64 dask.array<chunksize=(4,), meta=sparse.COO>"""
)
> assert expected == repr(ds)
E AssertionError: assert '<xarray.Data...a=sparse.COO>' == '<xarray.Data...a=sparse.COO>'
E
E - <xarray.Dataset> Size: 32B
E ? ----------
E + <xarray.Dataset>
E Dimensions: (x: 4)
E Dimensions without coordinates: x
E Data variables:
E - a (x) float64 32B dask.array<chunksize=(4,), meta=sparse.COO>
E ? ----
E + a (x) float64 dask.array<chunksize=(4,), meta=sparse.COO>
/Users/runner/work/xarray/xarray/xarray/tests/test_sparse.py:722: AssertionError