Created
May 3, 2013 11:24
-
-
Save xsleonard/5508581 to your computer and use it in GitHub Desktop.
voluptuous validation failure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from voluptuous import Schema | |
data = { | |
'InactiveMails': 26, | |
'Bounces': [ | |
{ | |
'Name': 'All', | |
'Count': 30 | |
}, | |
{ | |
'Type': 'HardBounce', | |
'Name': 'Hard bounce', | |
'Count': 26 | |
}, | |
{ | |
'Type': 'Transient', | |
'Name': 'Message delayed', | |
'Count': 3 | |
}, | |
{ | |
'Type': 'Blocked', | |
'Name': 'ISP block', | |
'Count': 1 | |
} | |
] | |
} | |
schema = Schema(data, required=True) | |
# Fails with: | |
# voluptuous.voluptuous.MultipleInvalid: not a valid value for dictionary value @ data['Bounces'][1]['Count'] | |
schema(data) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment