Skip to content

Commit 90968b6

Browse files
ruff fix
1 parent 79b56a1 commit 90968b6

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

src/esmf_regrid/experimental/partition.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ def __repr__(self):
173173
"""Return a representation of the class."""
174174
result = (
175175
f"Partition("
176-
f"src={repr(self.src)}, "
177-
f"tgt={repr(self.tgt)}, "
176+
f"src={self.src!r}, "
177+
f"tgt={self.tgt!r}, "
178178
f"scheme={self.scheme}, "
179179
f"num file_names={len(self.file_names)},"
180180
f"num saved_files={len(self.saved_files)})"

src/esmf_regrid/tests/unit/experimental/partition/test_PartialRegridder.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,20 @@
66
_grid_cube,
77
)
88

9+
910
def test_PartialRegridder_repr():
1011
"""Test repr of PartialRegridder instance."""
1112
src = _grid_cube(10, 15, (-180, 180), (-90, 90), circular=True)
1213
tgt = _grid_cube(5, 10, (-180, 180), (-90, 90), circular=True)
13-
src_slice = ((10,20), (15, 30))
14+
src_slice = ((10, 20), (15, 30))
1415
tgt_slice = ((0, 5), (0, 10))
1516
weights = None
1617
scheme = ESMFAreaWeighted(mdtol=0.5)
1718

1819
pr = PartialRegridder(src, tgt, src_slice, tgt_slice, weights, scheme)
1920

20-
expected_repr = ("PartialRegridder(src_slice=((10, 20), (15, 30)), tgt_slice=((0, 5), (0, 10)), "
21-
"scheme=ESMFAreaWeighted(mdtol=0.5, use_src_mask=False, use_tgt_mask=False, esmf_args={}))")
21+
expected_repr = (
22+
"PartialRegridder(src_slice=((10, 20), (15, 30)), tgt_slice=((0, 5), (0, 10)), "
23+
"scheme=ESMFAreaWeighted(mdtol=0.5, use_src_mask=False, use_tgt_mask=False, esmf_args={}))"
24+
)
2225
assert repr(pr) == expected_repr

src/esmf_regrid/tests/unit/experimental/partition/test_Partition.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ def test_nearest_invalid(tmp_path):
266266
with pytest.raises(NotImplementedError):
267267
_ = Partition(src_cube, tgt_grid, scheme, files, src_chunks=chunks)
268268

269+
269270
def test_Partition_repr(tmp_path):
270271
"""Test repr of Partition instance."""
271272
src_cube, tgt_grid, _ = _make_full_cubes()
@@ -275,9 +276,11 @@ def test_Partition_repr(tmp_path):
275276

276277
partition = Partition(src_cube, tgt_grid, scheme, files, src_chunks=chunks)
277278

278-
expected_repr = ("Partition(src=<iris 'Cube' of air_temperature / (K) "
279-
"(height: 2; latitude: 3; time: 4; longitude: 5; -- : 6)>, "
280-
"tgt=<iris 'Cube' of unknown / (unknown) (latitude: 5; longitude: 3)>, "
281-
"scheme=ESMFAreaWeighted(mdtol=0, use_src_mask=False, use_tgt_mask=False, esmf_args={}), "
282-
"num file_names=4,num saved_files=0)")
279+
expected_repr = (
280+
"Partition(src=<iris 'Cube' of air_temperature / (K) "
281+
"(height: 2; latitude: 3; time: 4; longitude: 5; -- : 6)>, "
282+
"tgt=<iris 'Cube' of unknown / (unknown) (latitude: 5; longitude: 3)>, "
283+
"scheme=ESMFAreaWeighted(mdtol=0, use_src_mask=False, use_tgt_mask=False, esmf_args={}), "
284+
"num file_names=4,num saved_files=0)"
285+
)
283286
assert repr(partition) == expected_repr

0 commit comments

Comments
 (0)