RestrictValueList¶
- class ipkiss3.all.RestrictValueList(allowed_values)¶
restrict the argument to a list of allowed values
- Parameters
- allowed_values: tuple, list
A tuple of allowed values
Examples
from ipkiss.all import * class Example(StrongPropertyInitializer): num_prop = DefinitionProperty(restriction=RestrictValueList((2, 4, 'str')) example1 = Example(num_prop=2) # this is ok example2 = Example(num_prop='str') # this is ok as well example3 = Example(num_prop=1) # this will fail
- allowed_values¶
- validate(value, obj=None)¶