Exemple #1
0
 def test_hasattr(self):
     foo = AttrDict(bar='baz')
     assert hasattr(foo, 'bar')
     assert not hasattr(foo, 'baz')
Exemple #2
0
 def test_set_attribute_proxies_key(self):
     foo = AttrDict()
     foo.bar = 'baz'
     assert foo['bar'] == 'baz'
Exemple #3
0
 def test_get_attribte(self):
     foo = AttrDict(bar='baz')
     assert foo.bar == 'baz'
Exemple #4
0
 def test_set_attribute(self):
     foo = AttrDict()
     foo.bar = 'baz'
     assert foo.bar == 'baz'
Exemple #5
0
 def test_get_attribute_raises(self):
     foo = AttrDict()
     self.assertRaises(AttributeError, lambda: foo.bar)