Skip to content

Commit 139d625

Browse files
committed
Fix formatting of test_dataarray.TestDataArray.test_expand_dims_with_greater_dim_size and test_dataset.TestDataset.test_expand_dims to be pep8
1 parent 2d1d069 commit 139d625

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

xarray/tests/test_dataarray.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,8 +1412,9 @@ def test_expand_dims_with_greater_dim_size(self):
14121412
dim_1=['a', 'b', 'c'],
14131413
x=np.linspace(0, 1, 3),
14141414
dim_0=range(4)),
1415-
dims=['y', 'z', 'dim_1', 'x', 'dim_0']
1416-
).drop(['y', 'dim_0']).assign_attrs(key="entry")
1415+
dims=['y', 'z', 'dim_1', 'x', 'dim_0'],
1416+
attrs={'key': 'entry'}
1417+
).drop(['y', 'dim_0'])
14171418
assert_identical(expected, actual)
14181419

14191420
# Test with kwargs instead of passing dict to dim arg.

xarray/tests/test_dataset.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2064,21 +2064,20 @@ def test_expand_dims(self):
20642064
# that DOES have coordinates.
20652065
actual = original.expand_dims({"d": 4, "e": ["l", "m", "n"]})
20662066

2067-
expected = Dataset({
2068-
'x': xr.DataArray(original['x'].values * np.ones([4, 3, 3]),
2069-
coords=dict(d=range(4),
2070-
e=['l', 'm', 'n'],
2071-
a=np.linspace(0, 1, 3)),
2072-
dims=['d', 'e', 'a']
2073-
).drop('d'),
2074-
'y': xr.DataArray(original['y'].values * np.ones([4, 3, 4, 3]),
2075-
coords=dict(d=range(4),
2076-
e=['l', 'm', 'n'],
2077-
b=np.linspace(0, 1, 4),
2078-
a=np.linspace(0, 1, 3)),
2079-
dims=['d', 'e', 'b', 'a']
2080-
).drop('d')
2081-
}).assign_coords(c=np.linspace(0, 1, 5)).assign_attrs(key="entry")
2067+
expected = Dataset(
2068+
{'x': xr.DataArray(original['x'].values * np.ones([4, 3, 3]),
2069+
coords=dict(d=range(4),
2070+
e=['l', 'm', 'n'],
2071+
a=np.linspace(0, 1, 3)),
2072+
dims=['d', 'e', 'a']).drop('d'),
2073+
'y': xr.DataArray(original['y'].values * np.ones([4, 3, 4, 3]),
2074+
coords=dict(d=range(4),
2075+
e=['l', 'm', 'n'],
2076+
b=np.linspace(0, 1, 4),
2077+
a=np.linspace(0, 1, 3)),
2078+
dims=['d', 'e', 'b', 'a']).drop('d')},
2079+
coords={'c': np.linspace(0, 1, 5)},
2080+
attrs={'key': 'entry'})
20822081
assert_identical(actual, expected)
20832082

20842083
# Test with kwargs instead of passing dict to dim arg.

0 commit comments

Comments
 (0)