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

All Samples(5)  |  Call(4)  |  Derive(0)  |  Import(1)

src/d/h/DHTBot-HEAD/dhtbot/test/kademlia/test_routing_table.py   DHTBot(Download)
from dhtbot.kademlia import routing_table
from dhtbot.kademlia.kbucket import KBucket
from dhtbot.kademlia.routing_table import _TreeNode, TreeRoutingTable, \
                                         SubsecondRoutingTable
from dhtbot.test import testing_data
    def test_split_validLeftOneLevel(self):
        # node_id 17 will cause the right kbucket to take on the larger size
        rt = SubsecondRoutingTable(17)
        self._split_and_assert_sizes(rt, rt.root, 8, 128)
 
    def test_split_validRightOneLevel(self):
        # node_id 2**159 + 1 will cause the
        # left kbucket to take on the larger size
        rt = SubsecondRoutingTable(2**159 + 1)
    def test_split_validLeftAllTheWayDown(self):
        # node_id 1 will cause the right kbucket to take on the larger size
        rt = SubsecondRoutingTable(1)
        self._split_and_assert_sizes(rt, rt.root, 8, 128)
        lchild = rt.root.lchild
    def test_offer_node_secondKBucketSplit(self):
        # ID of 2**160 - 1 will cause KBuckets on the left
        # side of the tree to expand in size (ie 128 maxsize)
        rt = SubsecondRoutingTable(2**160 - 1)
        # overflow first bucket