本文整理匯總了Python中dht.crawling.RPCFindResponse類的典型用法代碼示例。如果您正苦於以下問題:Python RPCFindResponse類的具體用法?Python RPCFindResponse怎麽用?Python RPCFindResponse使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了RPCFindResponse類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_happened
def test_happened(self):
response = (True, ("value", "some_value"))
r = RPCFindResponse(response)
self.assertTrue(r.happened())
response = (False, ("value", "some_value"))
r = RPCFindResponse(response)
self.assertFalse(r.happened())
示例2: test_hasValue
def test_hasValue(self):
response = (True, ("value", "some_value"))
r = RPCFindResponse(response)
self.assertTrue(r.hasValue())
response = (False, "a node")
r = RPCFindResponse(response)
self.assertFalse(r.hasValue())
示例3: test_getNodeList
def test_getNodeList(self):
node1 = Node(digest("id1"), "127.0.0.1", 12345, signed_pubkey=digest("key1"), vendor=True)
node2 = Node(digest("id2"), "127.0.0.1", 22222, signed_pubkey=digest("key2"), vendor=True)
node3 = Node(digest("id3"), "127.0.0.1", 77777, signed_pubkey=digest("key3"))
response = (True, (node1.getProto().SerializeToString(), node2.getProto().SerializeToString(), node3.getProto().SerializeToString(),
"sdfasdfsd"))
r = RPCFindResponse(response)
nodes = r.getNodeList()
self.assertEqual(nodes[0].getProto(), node1.getProto())
self.assertEqual(nodes[1].getProto(), node2.getProto())
self.assertEqual(nodes[2].getProto(), node3.getProto())
示例4: test_getNodeList
def test_getNodeList(self):
node1 = Node(digest("id1"), "127.0.0.1", 1234, digest("key1"), None, FULL_CONE, True)
node2 = Node(digest("id2"), "248.130.11.21", 1111, digest("key2"), None, FULL_CONE, True)
node3 = Node(digest("id3"), "987.567.23.1", 23456, digest("key3"), None, FULL_CONE, False)
response = (True, (node1.getProto().SerializeToString(), node2.getProto().SerializeToString(),
node3.getProto().SerializeToString(),
"sdfasdfsd"))
r = RPCFindResponse(response)
nodes = r.getNodeList()
self.assertEqual(nodes[0].getProto(), node1.getProto())
self.assertEqual(nodes[1].getProto(), node2.getProto())
self.assertEqual(nodes[2].getProto(), node3.getProto())
示例5: test_getValue
def test_getValue(self):
response = (True, ("value", "some_value"))
r = RPCFindResponse(response)
self.assertEqual(r.getValue(), ("some_value",))