def setUp(self):
     super(TestList, self).setUp()
     self.field = fields.Field(fields.List(FakeFieldType()))
     self.coerce_good_values = [(['foo', 'bar'], ['*foo*', '*bar*'])]
     self.coerce_bad_values = ['foo']
     self.to_primitive_values = [(['foo'], ['!foo!'])]
     self.from_primitive_values = [(['!foo!'], ['foo'])]
예제 #2
0
 def __init__(self, objtype, subclasses=False, relation=False, **kwargs):
     self.AUTO_TYPE = ovoo_fields.List(
         ovoo_fields.Object(objtype, subclasses))
     self.objname = objtype
     super(ObjectFields, self).__init__(objtype, **kwargs)
     self.relation = relation
예제 #3
0
 def __init__(self, objtype, subclasses=False, **kwargs):
     self.AUTO_TYPE = ovoo_fields.List(
         PolymorphicObject(objtype, subclasses))
     self.objname = objtype
     super(PolymorphicListOfObjectsField, self).__init__(**kwargs)
예제 #4
0
class ListOfIPAddressField(fields.AutoTypedField):
    AUTO_TYPE = fields.List(fields.IPAddress())
예제 #5
0
class ListOfIntegersField(fields.AutoTypedField):
    AUTO_TYPE = fields.List(fields.Integer())
예제 #6
0
 def test_iter_class(self):
     fields.List(fields.Integer).coerce(None, None, FakeCounter())
예제 #7
0
파일: fields.py 프로젝트: albertjone/senlin
class ListField(fields.AutoTypedField):
    AUTO_TYPE = fields.List(fields.FieldType())
예제 #8
0
 def test_non_iterable(self):
     self.assertRaises(ValueError,
                       fields.List(fields.Integer).coerce, None, None, 2)
예제 #9
0
class ListOfDictOfMiscValuesField(obj_fields.AutoTypedField):
    AUTO_TYPE = obj_fields.List(DictOfMiscValuesField())
예제 #10
0
 def test_regular_list(self):
     fields.List(fields.Integer).coerce(None, None, [1, 2])
예제 #11
0
class ListOfUUIDField(obj_fields.AutoTypedField):
    AUTO_TYPE = obj_fields.List(obj_fields.UUID())
예제 #12
0
class ListOfFlexibleDictsField(object_fields.AutoTypedField):
    AUTO_TYPE = object_fields.List(FlexibleDict())
예제 #13
0
 def __init__(self, element_type, **kwargs):
     self.AUTO_TYPE = fields.List(element_type())
     super(List, self).__init__(**kwargs)
예제 #14
0
class ListOfIPNetworksField(obj_fields.AutoTypedField):
    AUTO_TYPE = obj_fields.List(obj_fields.IPNetwork())
예제 #15
0
 def test_string_iterable(self):
     self.assertRaises(ValueError,
                       fields.List(fields.Integer).coerce, None, None,
                       'hello')
예제 #16
0
class ListOfUUIDsField(fields.AutoTypedField):
    AUTO_TYPE = fields.List(fields.UUID())
예제 #17
0
 def test_mapping_iterable(self):
     self.assertRaises(ValueError,
                       fields.List(fields.Integer).coerce, None, None, {
                           'a': 1,
                           'b': 2
                       })
예제 #18
0
class ListOfDictsField(fields.AutoTypedField):
    AUTO_TYPE = fields.List(fields.Dict(fields.FieldType()))
예제 #19
0
파일: fields.py 프로젝트: wanghuiict/zun
class ListOfListsOfStringsField(fields.AutoTypedField):
    AUTO_TYPE = fields.List(fields.List(fields.String()))