diff --git a/tests/test_tutorial/test_catching_exeptions.py b/tests/test_tutorial/test_catching_exeptions.py new file mode 100644 index 0000000..a045259 --- /dev/null +++ b/tests/test_tutorial/test_catching_exeptions.py @@ -0,0 +1,24 @@ +from src.tutorial.testing.practice.catching_exeptions import double_integers +import pytest + + +@pytest.mark.parametrize( + ("input", "expected"), + [ + ([1, 2, 3], [2, 4, 6]), + ([5], [10]), + ([100, 900, -2], [200, 1800, -4]), + ], +) +def test_double_integers(input, expected): + assert double_integers(input) == expected + + +def test_argument_is_list(): + with pytest.raises(TypeError, match="data must be a list"): + double_integers(4) + + +def test_list_with_integers_only(): + with pytest.raises(TypeError, match="data may contain only integers"): + double_integers([4, 3, 2, "str"])