当前位置: 首页>>代码示例>>Python>>正文


Python TestDisk.order方法代码示例

本文整理汇总了Python中ovs.dal.hybrids.t_testdisk.TestDisk.order方法的典型用法代码示例。如果您正苦于以下问题:Python TestDisk.order方法的具体用法?Python TestDisk.order怎么用?Python TestDisk.order使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ovs.dal.hybrids.t_testdisk.TestDisk的用法示例。


在下文中一共展示了TestDisk.order方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_copy

# 需要导入模块: from ovs.dal.hybrids.t_testdisk import TestDisk [as 别名]
# 或者: from ovs.dal.hybrids.t_testdisk.TestDisk import order [as 别名]
 def test_copy(self):
     """
     Validates whether the copy function works correct
     """
     machine = TestMachine()
     machine.name = 'testmachine1'
     machine.save()
     disk1 = TestDisk()
     disk1.name = 'test1'
     disk1.size = 100
     disk1.order = 1
     disk1.type = 'ONE'
     disk1.machine = machine
     disk1.save()
     disk2 = TestDisk()
     disk2.copy(disk1)
     self.assertEqual(disk2.name, 'test1', 'Properties should be copied')
     self.assertEqual(disk2.size, 100, 'Properties should be copied')
     self.assertEqual(disk2.order, 1, 'Properties should be copied')
     self.assertEqual(disk2.type, 'ONE', 'Properties should be copied')
     self.assertEqual(disk2.machine, None, 'Relations should not be copied')
     disk3 = TestDisk()
     disk3.copy(disk1, include_relations=True)
     self.assertEqual(disk3.machine.name, 'testmachine1', 'Relations should be copied')
     disk4 = TestDisk()
     disk4.copy(disk1, include=['name'])
     self.assertEqual(disk4.name, 'test1', 'Name should be copied')
     self.assertEqual(disk4.size, 0, 'Size should not be copied')
     self.assertEqual(disk4.machine, None, 'Relations should not be copied')
     disk5 = TestDisk()
     disk5.copy(disk1, exclude=['name'])
     self.assertEqual(disk5.name, None, 'Name should not be copied')
     self.assertEqual(disk5.size, 100, 'Size should be copied')
     self.assertEqual(disk5.machine, None, 'Relations should not be copied')
开发者ID:BillTheBest,项目名称:openvstorage,代码行数:36,代码来源:test_basic.py

示例2: test_typesafety

# 需要导入模块: from ovs.dal.hybrids.t_testdisk import TestDisk [as 别名]
# 或者: from ovs.dal.hybrids.t_testdisk.TestDisk import order [as 别名]
 def test_typesafety(self):
     """
     Validates typesafety checking on object properties
     """
     disk = TestDisk()
     disk.name = 'test'
     disk.name = u'test'
     disk.name = None
     disk.size = 100
     disk.size = 100.5
     disk.order = 100
     with self.assertRaises(TypeError):
         disk.order = 100.5
     with self.assertRaises(TypeError):
         disk.__dict__['wrong_type_data'] = None
         disk.wrong_type_data = 'string'
         _ = disk.wrong_type
     with self.assertRaises(TypeError):
         disk.type = 'THREE'
     disk.type = 'ONE'
开发者ID:BillTheBest,项目名称:openvstorage,代码行数:22,代码来源:test_basic.py


注:本文中的ovs.dal.hybrids.t_testdisk.TestDisk.order方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。