def test_clear(): bx = OrderedDiot() bx.a = 1 bx.c = 4 bx['g'] = 7 bx.d = 2 assert list(bx.keys()) == ['a', 'c', 'g', 'd'] bx.clear() assert bx == {} assert list(bx.keys()) == [] assert bx.__diot__['orderedkeys'] == []
def test_ordered_box(): bx = OrderedDiot(h=1) bx.a = 1 bx.c = 4 bx['g'] = 7 bx.d = 2 assert list(bx.keys()) == ['h', 'a', 'c', 'g', 'd'] del bx.a bx.pop('c') bx.__delattr__('g') assert list(bx.keys()) == ['h', 'd']
def test_revesed(): bx = OrderedDiot() bx.a = 1 bx.c = 2 assert list(reversed(bx)) == ['c', 'a']
def test_iter(): bx = OrderedDiot() bx.a = 1 bx.c = 2 assert list(bx.__iter__()) == ['a', 'c']