Skip to content

Commit

Permalink
more flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
ESadek-MO committed Nov 24, 2023
1 parent 10b241b commit 404aa26
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
6 changes: 2 additions & 4 deletions esmf_regrid/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ class NormType(Enum):

def check_method(method):
"""
Checks that method is a member of the `Constants.Method` enim, else raises
an error.
Checks that method is a member of the `Constants.Method` enim, else raises an error.
"""
if method in method_dict.keys():
result = method_dict[method]
Expand All @@ -52,8 +51,7 @@ def check_method(method):

def check_norm(norm):
"""
Checks that normtype is a member of the `Constants.NormType` enum, else raises
an error.
Checks that normtype is a member of the `Constants.NormType` enum, else raises an error.
"""
if norm in norm_dict.keys():
result = norm_dict[norm]
Expand Down
8 changes: 4 additions & 4 deletions esmf_regrid/tests/unit/esmf_regridder/test_Constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
],
)
def test_check_method_validates(method):
"""Tests that `check_method()` converts strings to enum"""
"""Tests that `check_method()` converts strings to enum."""
# with original text-input behaviour
assert check_method(method[0]) == method[1]
# with updated enum-input behaviour
assert check_method(method[1]) == method[1]


def test_invalid_method():
"""Ensures invalid methods raise an appropriate error, via string and enum"""
"""Ensures invalid methods raise an appropriate error, via string and enum."""
with pytest.raises(ValueError):
_ = check_method("other")
with pytest.raises(AttributeError):
Expand All @@ -37,15 +37,15 @@ def test_invalid_method():
],
)
def test_check_norm_validates(norm):
"""Tests that `check_norm()` converts strings to enum"""
"""Tests that `check_norm()` converts strings to enum."""
# with original text-input behaviour
assert check_norm(norm[0]) == norm[1]
# with updated enum-input behaviour
assert check_norm(norm[1]) == norm[1]


def test_invalid_norm():
"""Ensures invalid norms raise an appropriate error, via string and enum"""
"""Ensures invalid norms raise an appropriate error, via string and enum."""
with pytest.raises(ValueError):
_ = check_norm("other")
with pytest.raises(AttributeError):
Expand Down

0 comments on commit 404aa26

Please sign in to comment.