本文整理汇总了Python中cybox.objects.uri_object.URI.to_dict方法的典型用法代码示例。如果您正苦于以下问题:Python URI.to_dict方法的具体用法?Python URI.to_dict怎么用?Python URI.to_dict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cybox.objects.uri_object.URI
的用法示例。
在下文中一共展示了URI.to_dict方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_round_trip
# 需要导入模块: from cybox.objects.uri_object import URI [as 别名]
# 或者: from cybox.objects.uri_object.URI import to_dict [as 别名]
def test_round_trip(self):
u = "http://www.example.com"
t = URI.TYPE_URL
uri = URI(AnyURI(u), t)
uri2 = cybox.test.round_trip(uri)
self.assertEqual(uri.to_dict(), uri2.to_dict())
self.assertEqual(u, str(uri2))
self.assertEqual(t, uri2.type_)
示例2: test_unicode
# 需要导入模块: from cybox.objects.uri_object import URI [as 别名]
# 或者: from cybox.objects.uri_object.URI import to_dict [as 别名]
def test_unicode(self):
u = u"www.\u0395\u03a7\u0391\u039c\u03a1LE.com"
uri = URI(u, URI.TYPE_DOMAIN)
uri2 = cybox.test.round_trip(uri)
self.assertEqual(uri.to_dict(), uri2.to_dict())