# Path: src/lupin/validators/validator.py
# class Validator(object):
#     """Validators base class"""
# 
#     def __and__(self, other):
#         """Combine current validator with another one using the & operator
# 
#         Returns:
#             ValidatorsAndCombination
#         """
#         return lupin.ValidatorsAndCombination([self, other])
# 
#     def __or__(self, other):
#         """Combine current validator with another one using the | operator
# 
#         Returns:
#             ValidatorsOrCombination
#         """
#         return lupin.ValidatorsOrCombination([self, other])
# 
# Path: src/lupin/errors.py
# class NotEqual(ValidationError):
#     """Error raised by `Equal` validator"""
# 
#     def __init__(self, invalid, expected, path):
#         """
#         Args:
#             invalid (object): invalid value
#             expected (object): expected value
#             path (list): path of the invalid data
#         """
#         message = "Invalid value, got %s instead of %s" % (invalid, expected)
#         super(NotEqual, self).__init__(message, path)
#         self.invalid = invalid
#         self.expected = expected


from . import Validator
from ..errors import NotEqual


class Equal(Validator):
    """Validate that a value equals an expected one"""

    def __init__(self, expected):
        """
        Args:
            expected (object): expected value
        """
        self._expected = expected

    def __call__(self, value, path):
        """Validate that value equals expected one

        Args:
            value (object): value to validate
            path (list): error path
        """
        if value != self._expected:

# Path: src/lupin/validators/validator.py
# class Validator(object):
#     """Validators base class"""
# 
#     def __and__(self, other):
#         """Combine current validator with another one using the & operator
# 
#         Returns:
#             ValidatorsAndCombination
#         """
#         return lupin.ValidatorsAndCombination([self, other])
# 
#     def __or__(self, other):
#         """Combine current validator with another one using the | operator
# 
#         Returns:
#             ValidatorsOrCombination
#         """
#         return lupin.ValidatorsOrCombination([self, other])
# 
# Path: src/lupin/errors.py
# class NotEqual(ValidationError):
#     """Error raised by `Equal` validator"""
# 
#     def __init__(self, invalid, expected, path):
#         """
#         Args:
#             invalid (object): invalid value
#             expected (object): expected value
#             path (list): path of the invalid data
#         """
#         message = "Invalid value, got %s instead of %s" % (invalid, expected)
#         super(NotEqual, self).__init__(message, path)
#         self.invalid = invalid
#         self.expected = expected


# Path: src/lupin/validators/equal.py
from . import Validator
from ..errors import NotEqual



class Equal(Validator):
    """Validate that a value equals an expected one"""

    def __init__(self, expected):
        """
        Args:
            expected (object): expected value
        """
        self._expected = expected

    def __call__(self, value, path):
        """Validate that value equals expected one

        Args:
            value (object): value to validate
            path (list): error path
        """
        if value != self._expected:

            raise NotEqual(value, self._expected, path)