本文整理汇总了Python中oslo_versionedobjects.fields.List方法的典型用法代码示例。如果您正苦于以下问题:Python fields.List方法的具体用法?Python fields.List怎么用?Python fields.List使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oslo_versionedobjects.fields
的用法示例。
在下文中一共展示了fields.List方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from oslo_versionedobjects import fields [as 别名]
# 或者: from oslo_versionedobjects.fields import List [as 别名]
def __init__(self, objtype, subclasses=False, **kwargs):
self.AUTO_TYPE = ovoo_fields.List(
PolymorphicObject(objtype, subclasses))
self.objname = objtype
super(PolymorphicListOfObjectsField, self).__init__(**kwargs)
示例2: setUp
# 需要导入模块: from oslo_versionedobjects import fields [as 别名]
# 或者: from oslo_versionedobjects.fields import List [as 别名]
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'])]
示例3: test_regular_list
# 需要导入模块: from oslo_versionedobjects import fields [as 别名]
# 或者: from oslo_versionedobjects.fields import List [as 别名]
def test_regular_list(self):
fields.List(fields.Integer).coerce(None, None, [1, 2])
示例4: test_non_iterable
# 需要导入模块: from oslo_versionedobjects import fields [as 别名]
# 或者: from oslo_versionedobjects.fields import List [as 别名]
def test_non_iterable(self):
self.assertRaises(ValueError,
fields.List(fields.Integer).coerce, None, None, 2)
示例5: test_string_iterable
# 需要导入模块: from oslo_versionedobjects import fields [as 别名]
# 或者: from oslo_versionedobjects.fields import List [as 别名]
def test_string_iterable(self):
self.assertRaises(ValueError,
fields.List(fields.Integer).coerce, None, None,
'hello')
示例6: test_mapping_iterable
# 需要导入模块: from oslo_versionedobjects import fields [as 别名]
# 或者: from oslo_versionedobjects.fields import List [as 别名]
def test_mapping_iterable(self):
self.assertRaises(ValueError,
fields.List(fields.Integer).coerce, None, None,
{'a': 1, 'b': 2})