Skip to content

Commit 549dc59

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 64d14f9 commit 549dc59

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed

xarray/tests/test_datatree.py

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2425,32 +2425,35 @@ def test_arithmetic_inherited_coords(self) -> None:
24252425

24262426
def test_binary_op_compat_setting(self) -> None:
24272427
# Setting up a clash of non-index coordinate 'foo':
2428-
a = DataTree(xr.Dataset(
2429-
data_vars={"var": (["x"], [0, 0, 0])},
2430-
coords={
2431-
"x": [1, 2, 3],
2432-
"foo": (["x"], [1.0, 2.0, np.nan]),
2433-
},
2434-
))
2435-
b = DataTree(xr.Dataset(
2436-
data_vars={"var": (["x"], [0, 0, 0])},
2437-
coords={
2438-
"x": [1, 2, 3],
2439-
"foo": (["x"], [np.nan, 2.0, 3.0]),
2440-
},
2441-
))
2428+
a = DataTree(
2429+
xr.Dataset(
2430+
data_vars={"var": (["x"], [0, 0, 0])},
2431+
coords={
2432+
"x": [1, 2, 3],
2433+
"foo": (["x"], [1.0, 2.0, np.nan]),
2434+
},
2435+
)
2436+
)
2437+
b = DataTree(
2438+
xr.Dataset(
2439+
data_vars={"var": (["x"], [0, 0, 0])},
2440+
coords={
2441+
"x": [1, 2, 3],
2442+
"foo": (["x"], [np.nan, 2.0, 3.0]),
2443+
},
2444+
)
2445+
)
24422446

24432447
with xr.set_options(arithmetic_compat="minimal"):
2444-
expected = DataTree(a.dataset.drop_vars('foo'))
2448+
expected = DataTree(a.dataset.drop_vars("foo"))
24452449
assert_equal(a + b, expected)
24462450

24472451
with xr.set_options(arithmetic_compat="override"):
24482452
assert_equal(a + b, a)
24492453
assert_equal(b + a, b)
24502454

24512455
with xr.set_options(arithmetic_compat="no_conflicts"):
2452-
expected = DataTree(a.dataset.assign_coords(
2453-
foo=(["x"], [1.0, 2.0, 3.0])))
2456+
expected = DataTree(a.dataset.assign_coords(foo=(["x"], [1.0, 2.0, 3.0])))
24542457
assert_equal(a + b, expected)
24552458
assert_equal(b + a, expected)
24562459

0 commit comments

Comments
 (0)