Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(9)  |  Call(9)  |  Derive(0)  |  Import(0)

src/d/h/DHTBot-HEAD/dhtbot/test/kademlia/test_routing_table.py   DHTBot(Download)
    def test_offer_node_oneNode(self):
        rt = TreeRoutingTable(node_id=2**16)
        node_accepted = rt.offer_node(generate_node(15))
        self.assertTrue(node_accepted)
 
        # Insert nodes (offer_node)
        for node_id in range(0, 2**160, 2**156):
            node_accepted = rt.offer_node(generate_node(node_id + 1))
            self.assertTrue(node_accepted)
        self.assertEquals(16, len(nodes_in_rt(rt)))
    def test_offer_node_properNumKBuckets(self):
        rt = TreeRoutingTable(node_id=1)
        # range(2, 9) generates 7 numbers
        for node_id in range(2, 9):
            rt.offer_node(generate_node(node_id))
        rt.offer_node(generate_node(2**158))
        rt.offer_node(generate_node(2**159))