From 5535b704cebad3c4792d0e08080872fbfbe13e32 Mon Sep 17 00:00:00 2001 From: Soledad Galli Date: Sat, 28 Jan 2023 19:58:53 -0300 Subject: [PATCH 1/2] reword dictionary check --- .../check_input_dictionary.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/feature_engine/_check_input_parameters/check_input_dictionary.py b/feature_engine/_check_input_parameters/check_input_dictionary.py index a9a0df9d8..aa47818a9 100644 --- a/feature_engine/_check_input_parameters/check_input_dictionary.py +++ b/feature_engine/_check_input_parameters/check_input_dictionary.py @@ -3,20 +3,20 @@ def _check_numerical_dict(dict_: Optional[dict]) -> Optional[dict]: """ - Checks if all values in dictionary are integers and floats. Can take None as - argument. + Checks that all values in the dictionary are integers and floats. It can take also + take None as value. Parameters ---------- - the_dict : dict - The dictionary that will be checked + dict_ : dict + The dictionary that will be checked. Raises ------ ValueError - If any of the values in the dictionary are not int or float + If any of the values in the dictionary are not int or float. TypeError - When argument type is not a dictionary. + When input type is not a dictionary. """ if isinstance(dict_, dict): From b7bf17bca47610324f1b37fd2eaa3cbc386c9f3c Mon Sep 17 00:00:00 2001 From: Soledad Galli Date: Sat, 28 Jan 2023 20:02:24 -0300 Subject: [PATCH 2/2] reword test name --- .../test_check_input_dictionary.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_check_input_parameters/test_check_input_dictionary.py b/tests/test_check_input_parameters/test_check_input_dictionary.py index 49b306586..9ef57ad98 100644 --- a/tests/test_check_input_parameters/test_check_input_dictionary.py +++ b/tests/test_check_input_parameters/test_check_input_dictionary.py @@ -6,12 +6,12 @@ @pytest.mark.parametrize("input_dict", [{"a": 1, "b": "c"}, {1: 1, 2: "c"}]) -def test_not_numerical_dict(input_dict): +def test_raises_error_when_item_in_dict_not_numerical(input_dict): with pytest.raises(ValueError): _check_numerical_dict(input_dict) @pytest.mark.parametrize("input_dict", [[1, 2, 3], (1, 2, 3), "hola", 5]) -def test_input_type(input_dict): +def test_raises_error_when_input_not_dictionary_or_none(input_dict): with pytest.raises(TypeError): _check_numerical_dict(input_dict)