Skip to content

Commit 41a7cbd

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 3eeca09 commit 41a7cbd

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/parcels/_core/utils/string.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33

44
def _assert_str_and_python_varname(name):
5-
65
if not isinstance(name, str):
76
raise TypeError(f"Expected a string for variable name, got {type(name).__name__} instead.")
87

@@ -11,7 +10,7 @@ def _assert_str_and_python_varname(name):
1110
if not name.isidentifier():
1211
msg += "not a valid identifier. HINT: avoid using spaces, special characters, and starting with a number."
1312
raise ValueError(msg)
14-
13+
1514
if iskeyword(name):
1615
msg += f"it is a reserved keyword. HINT: avoid using the following names: {', '.join(kwlist)}"
17-
raise ValueError(msg)
16+
raise ValueError(msg)

tests/test_field.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ def test_field_init_param_types():
1717
grid = XGrid.from_dataset(data)
1818

1919
with pytest.raises(TypeError, match="Expected a string for variable name, got int instead."):
20-
Field(name=123, data=data['data_g'], grid=grid)
20+
Field(name=123, data=data["data_g"], grid=grid)
2121

2222
for name in ["a b", "123", "while"]:
2323
with pytest.raises(ValueError, match=r"Received invalid Python variable name.*"):
24-
Field(name=name, data=data['data_g'], grid=grid)
24+
Field(name=name, data=data["data_g"], grid=grid)
2525

2626
with pytest.raises(ValueError, match="Expected `data` to be a uxarray.UxDataArray or xarray.DataArray"):
2727
Field(name="test", data=123, grid=grid)

tests/test_fieldset.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def test_fieldset_add_constant(fieldset):
3838
fieldset.add_constant("test_constant", 1.0)
3939
assert fieldset.test_constant == 1.0
4040

41+
4142
def test_fieldset_add_constant_int_name(fieldset):
4243
with pytest.raises(TypeError, match="Expected a string for variable name, got int instead."):
4344
fieldset.add_constant(123, 1.0)

0 commit comments

Comments
 (0)