RussBaz / enforce

Python 3.5+ runtime type checking for integration testing and data validation
542 stars 21 forks source link

Added correct handling of None values in TupleNode. #63

Closed smarie closed 6 years ago

smarie commented 6 years ago

Fixes #62.

You might wish to add corresponding unit tests:

This should not raise an error anymore:

from typing import Optional, Tuple
from enforce import runtime_validation

@runtime_validation
def foo(arg: Optional[Tuple[str, str]] = None):
    pass

foo()

While this should continue to raise an error as usual:

from typing import Tuple
from enforce import runtime_validation

@runtime_validation
def foo(arg: Tuple[str, str]):
    pass

foo(None)
coveralls commented 6 years ago

Coverage Status

Coverage decreased (-0.3%) to 93.368% when pulling bc51fab65da970ce515fccaddf61657b3d785a8c on smarie:master into caf1dc3984c595a120882337fa6c2a7d23d90201 on RussBaz:master.

coveralls commented 6 years ago

Coverage Status

Coverage decreased (-0.4%) to 93.322% when pulling fa5cc9911fc6efb57853b7c411c42d166b8c611d on smarie:master into caf1dc3984c595a120882337fa6c2a7d23d90201 on RussBaz:master.

smarie commented 6 years ago

As requested: merging this pull request with https://github.com/RussBaz/enforce/pull/64 in a single pull request from the dev branch