Skip to content

Commit 0353c40

Browse files
committed
Extended test_check_matching_problem_size with edge cases, made docstring conform to linting rules
1 parent 9c8613e commit 0353c40

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

kernel_tuner/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1117,7 +1117,7 @@ def compile_restrictions(
11171117
return noncompiled_restrictions + compiled_restrictions
11181118

11191119
def check_matching_problem_size(cached_problem_size, problem_size):
1120-
""" check if requested problem size matches the problem size in the cache"""
1120+
"""Check the if requested problem size matches the problem size in the cache."""
11211121
if not (np.array(cached_problem_size) == np.array(problem_size)).all():
11221122
raise ValueError(f"Cannot load cache which contains results for different problem_size, cache: {cached_problem_size}, requested: {problem_size}")
11231123

test/test_util_functions.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,11 +732,16 @@ def test_check_matching_problem_size():
732732
check_matching_problem_size(42, 1000)
733733
with pytest.raises(ValueError):
734734
check_matching_problem_size([42,1], 42)
735+
with pytest.raises(ValueError):
736+
check_matching_problem_size([42,0], 42)
737+
with pytest.raises(ValueError):
738+
check_matching_problem_size(None, 42)
735739
# these should not error
736740
check_matching_problem_size(1000, (1000,))
737741
check_matching_problem_size([1000], 1000)
738742
check_matching_problem_size(1000, 1000)
739743
check_matching_problem_size(1000, [1000])
744+
check_matching_problem_size([1000,], 1000)
740745

741746

742747
def test_convert_constraint_lambdas():

0 commit comments

Comments
 (0)