Skip to content

Commit

Permalink
black .
Browse files Browse the repository at this point in the history
  • Loading branch information
matthmey authored and niowniow committed Jan 10, 2020
1 parent 10030ff commit f95b028
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions xarray/tests/test_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -1724,15 +1724,23 @@ def test_hidden_zarr_keys(self):
pass

@pytest.mark.parametrize("group", [None, "group1"])
def test_write_persistence_modes(self,group):
def test_write_persistence_modes(self, group):
original = create_test_data()

# overwrite mode
with self.roundtrip(original, save_kwargs={"mode": "w","group":group}, open_kwargs={"group":group}) as actual:
with self.roundtrip(
original,
save_kwargs={"mode": "w", "group": group},
open_kwargs={"group": group},
) as actual:
assert_identical(original, actual)

# don't overwrite mode
with self.roundtrip(original, save_kwargs={"mode": "w-","group":group}, open_kwargs={"group":group}) as actual:
with self.roundtrip(
original,
save_kwargs={"mode": "w-", "group": group},
open_kwargs={"group": group},
) as actual:
assert_identical(original, actual)

# make sure overwriting works as expected
Expand All @@ -1746,16 +1754,20 @@ def test_write_persistence_modes(self,group):
self.save(original, store, mode="w-")

# check append mode for normal write
with self.roundtrip(original, save_kwargs={"mode": "a","group":group}, open_kwargs={"group":group}) as actual:
with self.roundtrip(
original,
save_kwargs={"mode": "a", "group": group},
open_kwargs={"group": group},
) as actual:
assert_identical(original, actual)

# check append mode for append write
ds, ds_to_append, _ = create_append_test_data()
ds, ds_to_append, _ = create_append_test_data()
with self.create_zarr_target() as store_target:
ds.to_zarr(store_target, mode="w", group=group)
ds_to_append.to_zarr(store_target, append_dim="time", group=group)
original = xr.concat([ds, ds_to_append], dim="time")
actual = xr.open_zarr(store_target,group=group)
actual = xr.open_zarr(store_target, group=group)
assert_identical(original, actual)

def test_compressor_encoding(self):
Expand Down

0 comments on commit f95b028

Please sign in to comment.