Skip to content

Commit 1c3ce2a

Browse files
committed
black
1 parent 28bbf96 commit 1c3ce2a

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

xarray/tests/test_backends.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2064,17 +2064,28 @@ def test_write_inconsistent_chunks(self) -> None:
20642064
def test_roundtrip_cftime_bnds(self):
20652065
# Regression test for issue #7794
20662066
import cftime
2067-
original = xr.Dataset(
2068-
{"foo": ("time", [0.]),
2069-
"time_bnds": (("time","bnds"), [[cftime.Datetime360Day(2005, 12, 1, 0, 0, 0, 0),
2070-
cftime.Datetime360Day(2005, 12, 2, 0, 0, 0, 0)]])},
2071-
{"time": [cftime.Datetime360Day(2005, 12, 1, 12, 0, 0, 0)]})
20722067

2068+
original = xr.Dataset(
2069+
{
2070+
"foo": ("time", [0.0]),
2071+
"time_bnds": (
2072+
("time", "bnds"),
2073+
[
2074+
[
2075+
cftime.Datetime360Day(2005, 12, 1, 0, 0, 0, 0),
2076+
cftime.Datetime360Day(2005, 12, 2, 0, 0, 0, 0),
2077+
]
2078+
],
2079+
),
2080+
},
2081+
{"time": [cftime.Datetime360Day(2005, 12, 1, 12, 0, 0, 0)]},
2082+
)
20732083

20742084
with create_tmp_file() as tmp_file:
20752085
original.to_netcdf(tmp_file)
20762086
with open_dataset(tmp_file) as actual:
2077-
tb = actual.time_bnds.values
2087+
# Needed to load time_bnds into memory
2088+
assert actual.time_bnds.values == original.time_bnds
20782089
chunked = actual.chunk(time=1)
20792090
with create_tmp_file() as tmp_file_chunked:
20802091
chunked.to_netcdf(tmp_file_chunked)

0 commit comments

Comments
 (0)