Skip to content

Commit 28a149e

Browse files
committed
Improved tests using restrictions and extended parameters where necessary
1 parent 8da11a7 commit 28a149e

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

test/strategies/test_diff_evo.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,14 @@ def check_result(result, expected):
172172

173173
@pytest.mark.parametrize("method", supported_methods)
174174
def test_diff_evo(vector_add, method):
175+
restrictions = [
176+
"test_string == 'alg_2'",
177+
"test_bool == True",
178+
"test_mixed == 2.45"
179+
]
175180
result, _ = tune_kernel(
176181
*vector_add,
182+
restrictions=restrictions,
177183
strategy="diff_evo",
178184
strategy_options=dict(popsize=5, method=method),
179185
verbose=True,

test/strategies/test_strategies.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ def test_strategies(vector_add, strategy):
125125
assert isinstance(res[expected_key], expected_type)
126126

127127
# check if strategy respects user-specified starting point (x0)
128-
x0 = [256]
128+
x0 = [256, 'alg_2', 15, True, 2.45]
129129
filter_options["x0"] = x0
130-
if not strategy in ["brute_force", "random_sample", "bayes_opt"]:
130+
if not strategy in ["brute_force", "random_sample", "bayes_opt", "pyatf_strategies"]:
131131
results, _ = kernel_tuner.tune_kernel(*vector_add, restrictions=restrictions, strategy=strategy, strategy_options=filter_options,
132132
verbose=False, cache=cache_filename, simulation_mode=True)
133133
assert results[0]["block_size_x"] == x0[0]

0 commit comments

Comments
 (0)