diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-23 05:06:46 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-23 05:06:46 +0000 |
commit | 92240acb5cc600eec60624ece9ed4b9ec43b386f (patch) | |
tree | 13328d0de4f37030731a96e25749563742fce0cb /tests/units/test_tools.py | |
parent | Adding upstream version 0.14.0. (diff) | |
download | anta-92240acb5cc600eec60624ece9ed4b9ec43b386f.tar.xz anta-92240acb5cc600eec60624ece9ed4b9ec43b386f.zip |
Adding upstream version 0.15.0.upstream/0.15.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | tests/units/test_tools.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/units/test_tools.py b/tests/units/test_tools.py index a846fd6..c3a57e5 100644 --- a/tests/units/test_tools.py +++ b/tests/units/test_tools.py @@ -11,7 +11,7 @@ from typing import Any import pytest -from anta.tools import get_dict_superset, get_failed_logs, get_item, get_value +from anta.tools import custom_division, get_dict_superset, get_failed_logs, get_item, get_value TEST_GET_FAILED_LOGS_DATA = [ {"id": 1, "name": "Alice", "age": 30, "email": "alice@example.com"}, @@ -488,3 +488,17 @@ def test_get_item( # pylint: disable=too-many-arguments with expected_raise: assert get_item(list_of_dicts, key, value, default, var_name, custom_error_msg, required=required, case_sensitive=case_sensitive) == expected_result + + +@pytest.mark.parametrize( + ("numerator", "denominator", "expected_result"), + [ + pytest.param(4.0, 2.0, 2, id="int return for float input"), + pytest.param(4, 2, 2, id="int return for int input"), + pytest.param(5.0, 2.0, 2.5, id="float return for float input"), + pytest.param(5, 2, 2.5, id="float return for int input"), + ], +) +def test_custom_division(numerator: float, denominator: float, expected_result: str) -> None: + """Test custom_division.""" + assert custom_division(numerator, denominator) == expected_result |