Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions feature_engine/_check_input_parameters/check_input_dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)