本文整理汇总了Python中sas.models.SphereModel.SphereModel.__reduce_ex__方法的典型用法代码示例。如果您正苦于以下问题:Python SphereModel.__reduce_ex__方法的具体用法?Python SphereModel.__reduce_ex__怎么用?Python SphereModel.__reduce_ex__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sas.models.SphereModel.SphereModel
的用法示例。
在下文中一共展示了SphereModel.__reduce_ex__方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestSphere
# 需要导入模块: from sas.models.SphereModel import SphereModel [as 别名]
# 或者: from sas.models.SphereModel.SphereModel import __reduce_ex__ [as 别名]
class TestSphere(unittest.TestCase):
def setUp(self):
self.sphere = SphereModel()
def test_state_IO(self):
"""
Check that a state oject is independent from the model object it
was generated with
"""
self.sphere.setParam('radius', 44.0)
_, _, state, _, _ = self.sphere.__reduce_ex__(0)
sphere_copy = SphereModel()
sphere_copy.__setstate__(state)
sphere_clone = sphere_copy.clone()
self.assertEqual(sphere_copy.getParam('radius'), 44)
self.sphere.setParam('radius', 33.0)
self.assertEqual(sphere_clone.getParam('radius'), 44)