def test_hasattr(self): foo = AttrDict(bar='baz') assert hasattr(foo, 'bar') assert not hasattr(foo, 'baz')
def test_set_attribute_proxies_key(self): foo = AttrDict() foo.bar = 'baz' assert foo['bar'] == 'baz'
def test_get_attribte(self): foo = AttrDict(bar='baz') assert foo.bar == 'baz'
def test_set_attribute(self): foo = AttrDict() foo.bar = 'baz' assert foo.bar == 'baz'
def test_get_attribute_raises(self): foo = AttrDict() self.assertRaises(AttributeError, lambda: foo.bar)