Пример #1
0
 def test_from_riak(self):
     f = Field()
     obj = object()
     self.assertEqual(f.from_riak(obj), obj)
Пример #2
0
 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))
Пример #3
0
 def test_validate(self):
     f = Field()
     f.validate("foo")
     f.validate(object())
     self.assertRaises(ValidationError, f.validate, None)
Пример #4
0
 def test_validate_null(self):
     f = Field(null=True)
     f.validate("foo")
     f.validate(None)
Пример #5
0
 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))
Пример #6
0
 def test_from_riak(self):
     f = Field()
     obj = object()
     self.assertEqual(f.from_riak(obj), obj)
Пример #7
0
 def test_validate_null(self):
     f = Field(null=True)
     f.validate("foo")
     f.validate(None)
Пример #8
0
 def test_validate(self):
     f = Field()
     f.validate("foo")
     f.validate(object())
     self.assertRaises(ValidationError, f.validate, None)
Пример #9
0
 class BaseFieldModel(Model):
     """
     Toy model for Field tests.
     """
     f = Field()