Skip to content

Create test for Check Type Assertion #29

@lvrfrc87

Description

@lvrfrc87

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

No one assigned

    Labels

    status: acceptedThis issue has been accepted by the maintainers team for implementationtype: tests

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions