本文整理汇总了Python中obspy.core.event.ResourceIdentifier.setReferredObject方法的典型用法代码示例。如果您正苦于以下问题:Python ResourceIdentifier.setReferredObject方法的具体用法?Python ResourceIdentifier.setReferredObject怎么用?Python ResourceIdentifier.setReferredObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类obspy.core.event.ResourceIdentifier
的用法示例。
在下文中一共展示了ResourceIdentifier.setReferredObject方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_adding_a_referred_object_after_creation
# 需要导入模块: from obspy.core.event import ResourceIdentifier [as 别名]
# 或者: from obspy.core.event.ResourceIdentifier import setReferredObject [as 别名]
def test_adding_a_referred_object_after_creation(self):
"""
Check that the referred objects can also be made available after the
ResourceIdentifier instances have been created.
"""
obj = UTCDateTime()
obj_id = id(obj)
res_id = "obspy.org/time/test"
ref_a = ResourceIdentifier(res_id)
ref_b = ResourceIdentifier(res_id)
ref_c = ResourceIdentifier(res_id)
# All three will have no resource attached.
self.assertEqual(ref_a.getReferredObject(), None)
self.assertEqual(ref_b.getReferredObject(), None)
self.assertEqual(ref_c.getReferredObject(), None)
# Setting the object for one will make it available to all other
# instances.
ref_b.setReferredObject(obj)
self.assertEqual(id(ref_a.getReferredObject()), obj_id)
self.assertEqual(id(ref_b.getReferredObject()), obj_id)
self.assertEqual(id(ref_c.getReferredObject()), obj_id)