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


Python ResourceIdentifier.getQuakeMLURI方法代码示例

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


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

示例1: test_quakeml_regex

# 需要导入模块: from obspy.core.event import ResourceIdentifier [as 别名]
# 或者: from obspy.core.event.ResourceIdentifier import getQuakeMLURI [as 别名]
 def test_quakeml_regex(self):
     """
     Tests that regex used to check for QuakeML validatity actually works.
     """
     # This one contains all valid characters. It should pass the
     # validation.
     res_id = (
         "smi:abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
         "1234567890-.*()_~'/abcdefghijklmnopqrstuvwxyzABCDEFGHIKLMNOPQR"
         "STUVWXYZ0123456789-.*()_~'+?=,;&")
     res = ResourceIdentifier(res_id)
     self.assertEqual(res_id, res.getQuakeMLURI())
     # The id has to valid from start to end. Due to the spaces this cannot
     # automatically be converted to a correct one.
     res_id = ("something_before smi:local/something  something_after")
     res = ResourceIdentifier(res_id)
     self.assertRaises(ValueError, res.getQuakeMLURI)
     # A colon is an invalid character.
     res_id = ("smi:local/hello:yea")
     res = ResourceIdentifier(res_id)
     self.assertRaises(ValueError, res.getQuakeMLURI)
     # Space as well
     res_id = ("smi:local/hello yea")
     res = ResourceIdentifier(res_id)
     self.assertRaises(ValueError, res.getQuakeMLURI)
     # Dots are fine
     res_id = ("smi:local/hello....yea")
     res = ResourceIdentifier(res_id)
     self.assertEqual(res_id, res.getQuakeMLURI())
     # Hats not
     res_id = ("smi:local/hello^^yea")
     res = ResourceIdentifier(res_id)
     self.assertRaises(ValueError, res.getQuakeMLURI)
开发者ID:MAimmersivX,项目名称:obspy,代码行数:35,代码来源:test_event.py

示例2: test_resource_id_valid_quakemluri

# 需要导入模块: from obspy.core.event import ResourceIdentifier [as 别名]
# 或者: from obspy.core.event.ResourceIdentifier import getQuakeMLURI [as 别名]
 def test_resource_id_valid_quakemluri(self):
     """
     Test that a resource identifier per default (i.e. no arguments to
     __init__()) gets set up with a QUAKEML conform ID.
     """
     rid = ResourceIdentifier()
     self.assertEqual(rid.resource_id, rid.getQuakeMLURI())
开发者ID:MAimmersivX,项目名称:obspy,代码行数:9,代码来源:test_event.py


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