Open
Description
I want to be able to create a Schema with this idea:
s = Schema({
AtLeastOne('onetwo', 'group1'): Any(1, 2, None),
AtLeastOne('threefour', 'group1'): Any(3, 4, None),
'abc': 'abc'})
>>> s({'abc': 'abc'})
AtLeastOneInvalid: 'group1' must specify at least one of ['onetwo', 'threefour']
>>> s({'onetwo': 3, 'abc': 'abc'})
MultipleInvalid: not a valid value for dictionary value @ data['onetwo']
>>> s({'onetwo': 2, 'abc': 'abc'})
{'onetwo': 2, 'abc': 'abc'}
>>> s({'threefour': 4, 'abc': 'abc'})
{'threefour': 4, 'abc': 'abc'}
>>> s({'onetwo': 1, 'threefour': 3, 'abc': 'abc'})
{'onetwo': 1, 'threefour': 3, 'abc': 'abc'}
This completes the functionality started with the addition of Exclusive
and Inclusive
.
Metadata
Metadata
Assignees
Labels
No labels