def test_in(self): d = dotdict() assert 'val' not in d d.val = 7 assert 'val' in d del d.val assert 'val' not in d
def test_str(self): d = dotdict(val=7, foo='x') e = dict(val=7, foo='x') assert str(d) == str(e) d2 = dict(x=d) e2 = dict(x=e) assert str(d2) == str(e2)
def test_set_get_del(self): d = dotdict() assert d.val == None d.val = 'x' assert d.val == 'x' assert d['val'] == 'x' del d.val assert d.val == None d['val'] = 7 assert d['val'] == 7 assert d.val == 7 del d['val'] assert d['val'] == None
def __init__(self, transitions): self.transitions = transitions # TODO: do this in a cleaner way, such as a class decorator self._prv = dotdict() self._prv.spec_info = rv.SpecInfo() self._prv.spec_info.max_history_size = rv.NO_HISTORY
def test_initializer(self): d = dotdict(val=7, foo='x') assert 'val' in d assert d.val == 7 assert d.foo == 'x'