Skip to content

Commit

Permalink
MNT: Replace nested with blocks with a single one
Browse files Browse the repository at this point in the history
Found with flake8-simplify 0.14.0.
  • Loading branch information
dopplershift committed Feb 24, 2021
1 parent 38e6a32 commit 4d23c7b
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions tests/test_xarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,12 +376,12 @@ def test_resolve_axis_conflict_double_lonlat(test_ds_generic):
test_ds_generic['d'].attrs['_CoordinateAxisType'] = 'Lat'
test_ds_generic['e'].attrs['_CoordinateAxisType'] = 'Lon'

with pytest.warns(UserWarning, match='More than one x coordinate'):
with pytest.raises(AttributeError):
test_ds_generic['test'].metpy.x
with pytest.warns(UserWarning, match='More than one y coordinate'):
with pytest.raises(AttributeError):
test_ds_generic['test'].metpy.y
with pytest.warns(UserWarning, match='More than one x coordinate'),\
pytest.raises(AttributeError):
test_ds_generic['test'].metpy.x
with pytest.warns(UserWarning, match='More than one y coordinate'),\
pytest.raises(AttributeError):
test_ds_generic['test'].metpy.y


def test_resolve_axis_conflict_double_xy(test_ds_generic):
Expand All @@ -391,12 +391,12 @@ def test_resolve_axis_conflict_double_xy(test_ds_generic):
test_ds_generic['d'].attrs['standard_name'] = 'projection_x_coordinate'
test_ds_generic['e'].attrs['standard_name'] = 'projection_y_coordinate'

with pytest.warns(UserWarning, match='More than one x coordinate'):
with pytest.raises(AttributeError):
test_ds_generic['test'].metpy.x
with pytest.warns(UserWarning, match='More than one y coordinate'):
with pytest.raises(AttributeError):
test_ds_generic['test'].metpy.y
with pytest.warns(UserWarning, match='More than one x coordinate'),\
pytest.raises(AttributeError):
test_ds_generic['test'].metpy.x
with pytest.warns(UserWarning, match='More than one y coordinate'),\
pytest.raises(AttributeError):
test_ds_generic['test'].metpy.y


def test_resolve_axis_conflict_double_x_with_single_dim(test_ds_generic):
Expand All @@ -413,9 +413,9 @@ def test_resolve_axis_conflict_double_vertical(test_ds_generic):
test_ds_generic['b'].attrs['units'] = 'hPa'
test_ds_generic['c'].attrs['units'] = 'Pa'

with pytest.warns(UserWarning, match='More than one vertical coordinate'):
with pytest.raises(AttributeError):
test_ds_generic['test'].metpy.vertical
with pytest.warns(UserWarning, match='More than one vertical coordinate'),\
pytest.raises(AttributeError):
test_ds_generic['test'].metpy.vertical


criterion_matches = [
Expand Down

0 comments on commit 4d23c7b

Please sign in to comment.