RussBaz / enforce

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

If there is no 'return' annotation, return output instead of 'None' #28

Closed hwayne closed 7 years ago

hwayne commented 7 years ago

Setup:

from enforce import runtime_validation

@runtime_validation
def goofus(a: int):
  return a

@runtime_validation
def gallant(a: int) -> int:
  return a

Original behavior:

>>> print(gallant(1)) # ok
1
>>> print(goofus(1)) # bug
None

New behavior:

>>> print(goofus(1)) # ok now
1
coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.005%) to 95.762% when pulling 17845fb1fb265a7f45b531aa06f30c4ce85a7a92 on hwayne:fix-missing-return into 67b14610d4e7fa1867f2e1719ae1c80817a8010f on RussBaz:dev.

RussBaz commented 7 years ago

Oh, thanks a lot for noticing this!