Skip to content

Commit f3e534e

Browse files
committed
Use a single with context instead of nesting
1 parent c71c2f6 commit f3e534e

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

tests/integration/transpose_writers/test_chunking.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -152,16 +152,15 @@ def test_dimension_mismatch_warning(mdio_dataset: Path, caplog: pytest.LogCaptur
152152
chunk_grid = RegularChunkGrid(configuration=RegularChunkShape(chunk_shape=(8, 16)))
153153
compressor = Blosc(cname="zstd", clevel=5, shuffle="shuffle")
154154

155-
with caplog.at_level("WARNING"):
156-
with pytest.raises(ValueError, match="zip\\(\\) argument 2 is shorter than argument 1"):
157-
from_variable(
158-
dataset_path=mdio_dataset,
159-
source_variable="amplitude",
160-
new_variable="mismatched_dims",
161-
chunk_grid=chunk_grid,
162-
compressor=compressor,
163-
copy_metadata=True,
164-
)
155+
with caplog.at_level("WARNING"), pytest.raises(ValueError, match="zip\\(\\) argument 2 is shorter than argument 1"):
156+
from_variable(
157+
dataset_path=mdio_dataset,
158+
source_variable="amplitude",
159+
new_variable="mismatched_dims",
160+
chunk_grid=chunk_grid,
161+
compressor=compressor,
162+
copy_metadata=True,
163+
)
165164

166165
# Check that warning was logged before the error
167166
assert any("Original variable" in record.message and "dimensions" in record.message for record in caplog.records)

0 commit comments

Comments
 (0)