def test_set_attributes_manually(self):
     resource = APIResource(foo='bar')
     resource.bar = 'baz'
     assert resource.bar == 'baz'
     assert not hasattr(resource, 'baz')
 def test_get_attribute(self):
     resource = APIResource(foo='bar', val=22)
     assert resource.foo == 'bar'
     assert resource.val == 22
     assert resource._attributes == {'foo': 'bar', 'val': 22}
 def test_get_undefined_attribute(self):
     resource = APIResource(foo='bar', val=22)
     with pytest.raises(AttributeError) as excinfo:
         resource.baz
     assert '`baz`' in str(excinfo.value)