Skip to content

Commit c006fc3

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

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

mesa/batchrunner.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def _make_model_kwargs(
115115
Not allowed:
116116
- Empty lists or empty iterables (e.g., `[]`, `()`, etc.). These should be removed manually.
117117
118-
Returns
118+
Returns:
119119
-------
120120
List[Dict[str, Any]]
121121
A list of all kwargs combinations.
@@ -127,8 +127,10 @@ def _make_model_kwargs(
127127
all_values = [(param, values)]
128128
elif isinstance(values, list | tuple | set) and len(values) == 0:
129129
# If it's an empty iterable, raise an error
130-
raise ValueError(f"Parameter '{param}' contains an empty iterable, which is not allowed.")
131-
130+
raise ValueError(
131+
f"Parameter '{param}' contains an empty iterable, which is not allowed."
132+
)
133+
132134
else:
133135
try:
134136
all_values = [(param, value) for value in values]

tests/test_batch_run.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ def test_make_model_kwargs(): # noqa: D103
2626

2727
def test_batch_run_with_params_with_empty_content():
2828
"""Test handling of empty iterables in model kwargs."""
29-
3029
# If "a" is a single value and "b" is an empty list (should raise error for the empty list)
3130
parameters_with_empty_list = {
3231
"a": 3,
@@ -35,7 +34,9 @@ def test_batch_run_with_params_with_empty_content():
3534

3635
try:
3736
_make_model_kwargs(parameters_with_empty_list)
38-
raise AssertionError("Expected ValueError for empty iterable but no error was raised.")
37+
raise AssertionError(
38+
"Expected ValueError for empty iterable but no error was raised."
39+
)
3940
except ValueError as e:
4041
assert "contains an empty iterable" in str(e)
4142

@@ -47,7 +48,9 @@ def test_batch_run_with_params_with_empty_content():
4748

4849
try:
4950
_make_model_kwargs(parameters_with_empty_b)
50-
raise AssertionError("Expected ValueError for empty iterable but no error was raised.")
51+
raise AssertionError(
52+
"Expected ValueError for empty iterable but no error was raised."
53+
)
5154
except ValueError as e:
5255
assert "contains an empty iterable" in str(e)
5356

0 commit comments

Comments
 (0)