"""Tests for the string tool module.""" from typing import Any import pytest from aki_prj23_transparenzregister.utils import string_tools def test_import() -> None: """Tests if the import is possible.""" assert string_tools @pytest.mark.parametrize( ("value", "expected"), [ ("None ", "None"), (" ", None), ("", None), ("\t", None), ("\n", None), (" Some String ", "Some String"), ("Some String", "Some String"), ], ) def test_simplify_string(value: str | None, expected: str | None) -> None: """Tests the sting simplification.""" assert string_tools.simplify_string(value) == expected @pytest.mark.parametrize("value", [0, 0.1, True, ("1",), {}, set()]) def test_simplify_string_type_error(value: Any) -> None: """Tests if the type error is thrown when the value is the wrong type.""" with pytest.raises(TypeError): assert string_tools.simplify_string(value)