"""
>>> from wrapjson import *
>>> d = wrapJSON(dict(a=dict(a0=['a00',dict(b=dict(c=31,d=32,e='ABCDEF'))]),b=[1,2,3]),'json')
>>> d.__missing_report__
'Missing names/items report is not available'
>>> d.a.__class__.__name__,d.a.__safe__
('WrapJSONDict', False)
>>> list(d.items())
[('a', {'a0': ['a00', {'b': {'c': 31, 'd': 32, 'e': 'ABCDEF'}}]}), ('b', [1, 2, 3])]
>>> list((e.__class__.__name__ for e in d.values()))
['WrapJSONDict', 'WrapJSONList']
>>> d.b
[1, 2, 3]
>>> d['b']
[1, 2, 3]
>>> d.b.__class__.__name__
'WrapJSONList'
>>> d.b[0][1:2]
Traceback (most recent call last):
    ...
IndexError: No item 'slice(1, 2, None)' in json.b[0][slice(1, 2, None)]
>>> d.a.a0[1].b.e[0]
'A'
>>> d.a.a0[1].b.e[-1]
'F'
>>> d.a.a0[1].b.e[1::2]
'BDF'
>>> d.z
Traceback (most recent call last):
    ...
AttributeError: No attribute or key 'z' in json.z
>>> d.b["x"]
Traceback (most recent call last):
    ...
IndexError: No item 'x' in json.b['x']
>>> d = wrapJSON(dict(a=dict(a0=['a00',dict(b=dict(c=31,d=32))]),b=[1,2,3]),'json',True)
>>> d.__missing_report__
'No missing names or items'
>>> d.z, d.w
('', '')
>>> d.b["x"]
''
>>> d.__missing_report__
"Missing names or items\\n  json.b['x'] json.w json.z"
>>> d = wrapJSON(dict(a=dict(a0=['a00',dict(b=dict(c=31,d=32))]),b=[1,2,3]),'json',True)
>>> d.__set_defaults__({'json.z':42})
>>> d.z
42
>>> d.a.a0["x"], d.a.a0[13]
('', '')
>>> d.__missing_report__
"Missing names or items\\n  json.a.a0['x'] json.a.a0[13] json.z"
>>> d.a.a0[1].b.c
31

#in safe mode attributes of leaf scalars return themselves
>>> d.a.a0[1].b.c.y
31
>>> d.__missing_report__
"Missing names or items\\n  json.a.a0['x'] json.a.a0[13] json.a.a0[1].b.c.y json.z"

#accessing a list attribute should record and return empty
>>> d.a.a0.x
''
>>> d.__missing_report__
"Missing names or items\\n  json.a.a0.x json.a.a0['x'] json.a.a0[13] json.a.a0[1].b.c.y json.z"
"""
if __name__=='__main__':
    import os, sys, doctest
    sys.path.insert(0,os.path.normpath(os.path.join(os.path.dirname(__file__),'..')))
    doctest.testmod()
