-
Notifications
You must be signed in to change notification settings - Fork 6
Closed
Labels
status: acceptedThis issue has been accepted by the maintainers team for implementationThis issue has been accepted by the maintainers team for implementationtype: tests
Description
As we have some assertion within the CheckType Class, we would need to add tests in order to evaluate that such assertion are raising the error as expected. For example: regex implementation would need to test all the below
try:
parameter = value_to_compare[1]
except IndexError as error:
raise IndexError(
f"Evaluating parameter must be defined as dict at index 1. You have: {value_to_compare}"
) from error
# Assert that check parameters are at index 1.
if not all([isinstance(parameter, dict)]):
raise TypeError("check_option must be of type dict().")
# Assert that check option has 'regex' and 'mode' dict keys.
if not "regex" in parameter and "mode" in parameter:
raise KeyError(
"Regex check-type requires check-option. Example: dict(regex='.*UNDERLAY.*', mode='no-match')."
)
# Assert that check option has 'regex' and 'mode' dict keys.
if parameter["mode"] not in ["match", "no-match"]:
raise ValueError(
"Regex check-type requires check-option. Example: dict(regex='.*UNDERLAY.*', mode='no-match')."
)
Metadata
Metadata
Assignees
Labels
status: acceptedThis issue has been accepted by the maintainers team for implementationThis issue has been accepted by the maintainers team for implementationtype: tests