Skip to content

Commit

Permalink
Create test.py
Browse files Browse the repository at this point in the history
  • Loading branch information
shenfe authored Sep 10, 2018
1 parent 4849698 commit 7e7376c
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from azzert import azzert

data = {
'id': 123,
'name': 'tom',
'contact': {
'type': 'mobile',
'value': '10010001000',
},
'hobbies': ['swimming', 'movie'],
}

schema = {
'id': (int, str),
'name': str,
'contact': {
'type': {'mobile', 'email'},
'value': (True, str, lambda v: 0 < len(v) < 100),
},
'hobbies': ([str], None),
}

try:
result = azzert(data, schema)
except Exception as e:
raise e

0 comments on commit 7e7376c

Please sign in to comment.