sw6 testing hands on

This commit is contained in:
schaermicha1 committed 2026-03-27 21:01:31 +01:00
1 parent 5d0aa9c876
commit f089317e86
13 files changed
+314 -2

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
import pytest
from testing.catching_exeptions import double_integers
@pytest.mark.parametrize(
"data, expected_error",
[
(123, "data must be a list"),
([1, "2", 3, 4, 5], "data may contain only integers"),
],
)
def test_double_integers_unhappy_path(data, expected_error) -> None:
with pytest.raises(TypeError, match=expected_error):
double_integers(data)
@pytest.mark.parametrize(
"data, expected_result",
[
([1, 2, 3, 4, 5], [2, 4, 6, 8, 10]),
([0, -1, -2, -3, -4, -5], [0, -2, -4, -6, -8, -10]),
],
)
def test_double_integers_happy_path(data, expected_result) -> None:
assert double_integers(data) == expected_result