Code_PPII_FS26/tests/test_u6_catching_exceptions.py
2026-04-10 15:30:28 +02:00

19 lines
543 B
Python

from src.u6_tests.U6_Freitag_testing.catching_exeptions import double_integers
import pytest
def test_double_integers_with_invalid_input():
with pytest.raises(TypeError):
double_integers("not a list")
with pytest.raises(TypeError):
double_integers([1, 2, "not an int"])
@pytest.mark.parametrize(
"input_data, expected_output",
[([1, 2, 3], [2, 4, 6]), ([0, -1, -2], [0, -2, -4]), ([], [])],
)
def test_double_integers(input_data, expected_output):
assert double_integers(input_data) == expected_output