Advertisement
Guest User

Untitled

a guest
Nov 6th, 2013
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. def test_type_with_array_tojson(self):
  2. class AType(object):
  3. attr = int
  4.  
  5. def __init__(self, val):
  6. self.attr = val
  7.  
  8. class BType(object):
  9. attr = [AType]
  10.  
  11. def __init__(self, val):
  12. self.attr = val
  13.  
  14. wsme.types.register_type(BType)
  15. wsme.rest.json.foo = True
  16. j = tojson(BType, [BType([AType(1)])])
  17. assert j == {'attr': [{'attr': 1}]}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement