~chiefnoah/pybare

7d23cb1ffa88df448b15f5850881d6c2cf8a5c86 — Noah Pederson 8 months ago e272484
Fix return type matching type hinting

The abstract definition for Field.validate wasn't returning a tuple,
just a boolean. Update to return tuple with None as the default message
value
1 files changed, 2 insertions(+), 1 deletions(-)

M bare/encoder.py
M bare/encoder.py => bare/encoder.py +2 -1
@@ 16,6 16,7 @@ class ValidationError(ValueError):
    ValidationError is an error raised by a `Field` type when the `validate` class function
    determines a given value is 'out-of-spec'.
    """

    pass




@@ 110,7 111,7 @@ class Field(ABC):
        Checks whether a give value is valid for the Field's data type. Returns a tuple of a boolean
        and an optional message for why
        """
        return self.__class__._default == None  # This is valid for BareType.Void
        return self.__class__._default == None, None  # This is valid for BareType.Void

    @property
    def valid(self) -> typing.Tuple[bool, str]: