[go: up one dir, main page]

Skip to content

Add support for annotated types

example

Age = Annotated[int, Ge(1)]

@types_conditions
def birthday(age: Age) -> Age:
  return age + 1

print(birthday(0))
# Provided age (0) does not correspond to its type (Age = Annotated[int, Ge(1)])


@types_conditions
def birthday2(age) -> Age:
  return age + 1

print(birthday2(-1))
# Returned value (0) does not correspond to its type (Age = Annotated[int, Ge(1)])

references

Edited by Léo GERMOND