def testSplitBucket(self):
        self.failUnlessEqual(self.routingTable._buckets[0].rangeMax, 2**160, 'Initial k-bucket range should be 0 <= range < 2**160')
        # Add k contacts
        for i in range(lbrynet.dht.constants.k):
            h = hashlib.sha1()
            h.update('remote node %d' % i)
            nodeID = h.digest()
            contact = lbrynet.dht.contact.Contact(nodeID, '127.0.0.1', 91824, self.protocol)
            self.routingTable.addContact(contact)
        self.failUnlessEqual(len(self.routingTable._buckets), 1, 'Only k nodes have been added; the first k-bucket should now be full, but should not yet be split')
        # Now add 1 more contact
        h = hashlib.sha1()
        h.update('yet another remote node')
        nodeID = h.digest()
        contact = lbrynet.dht.contact.Contact(nodeID, '127.0.0.1', 91824, self.protocol)
        self.routingTable.addContact(contact)
        self.failUnlessEqual(len(self.routingTable._buckets), 2, 'k+1 nodes have been added; the first k-bucket should have been split into two new buckets')
        self.failIfEqual(self.routingTable._buckets[0].rangeMax, 2**160, 'K-bucket was split, but its range was not properly adjusted')
        self.failUnlessEqual(self.routingTable._buckets[1].rangeMax, 2**160, 'K-bucket was split, but the second (new) bucket\'s max range was not set properly')
        self.failUnlessEqual(self.routingTable._buckets[0].rangeMax, self.routingTable._buckets[1].rangeMin, 'K-bucket was split, but the min/max ranges were not divided properly')
Tests if the the routing table correctly dynamically splits k-buckets
dataset/ETHPy150Open lbryio/lbry/tests/dht/testRoutingTable.py/TreeRoutingTableTest.testSplitBucket