Skip to content

Commit 971781e

Browse files
committed
Add unit test for the '_parse_boolean' function
1 parent 3bc0037 commit 971781e

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

tests/client/contexts/test_fib.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
_file_transferred_to,
1515
_get_source,
1616
_number_from_name,
17+
_parse_boolean,
1718
)
1819

1920
# Mock session values
@@ -407,6 +408,26 @@ def test_number_from_name(test_params: tuple[str, int]):
407408
assert _number_from_name(name) == number
408409

409410

411+
@pytest.mark.parametrize(
412+
"test_params",
413+
( # Input | Expected output
414+
("True", True),
415+
("true", True),
416+
("T", True),
417+
("t", True),
418+
("1", True),
419+
("False", False),
420+
("false", False),
421+
("F", False),
422+
("f", False),
423+
("0", False),
424+
),
425+
)
426+
def test_parse_boolean(test_params: tuple[str, bool]):
427+
text, expected_result = test_params
428+
assert _parse_boolean(text) == expected_result
429+
430+
410431
def test_get_source(
411432
tmp_path: Path,
412433
visit_dir: Path,

0 commit comments

Comments
 (0)