def test_from_riak(self): f = Field() obj = object() self.assertEqual(f.from_riak(obj), obj)
def test_get_descriptor(self): f = Field() descriptor = f.get_descriptor("foo") self.assertEqual(descriptor.key, "foo") self.assertEqual(descriptor.field, f) self.assertTrue("Field object" in repr(descriptor))
def test_validate(self): f = Field() f.validate("foo") f.validate(object()) self.assertRaises(ValidationError, f.validate, None)
def test_validate_null(self): f = Field(null=True) f.validate("foo") f.validate(None)
class BaseFieldModel(Model): """ Toy model for Field tests. """ f = Field()