Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
koopmant committed Dec 18, 2024
1 parent 24d6916 commit 8f75134
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions app/tests/core_tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import pytest

from grandchallenge.core.utils import strtobool


@pytest.mark.parametrize(
"val, result",
[
("y", True),
("Y", True),
("yes", True),
("Yes", True),
("true", True),
("True", True),
("t", True),
("T", True),
("on", True),
("On", True),
("1", True),
("n", False),
("N", False),
("no", False),
("No", False),
("false", False),
("False", False),
("f", False),
("F", False),
("off", False),
("Off", False),
("0", False),
],
)
def test_strtobool(val, result):
assert strtobool(val) is result


def test_strtobool_exception():
with pytest.raises(ValueError):
strtobool("foobar")

0 comments on commit 8f75134

Please sign in to comment.