Exemple #1
0
    def test_sharedPrefix(self):
        args = ['prefix', 'prefixasdf', 'prefix', 'prefixxxx']
        self.assertEqual(sharedPrefix(args), 'prefix')

        args = ['p', 'prefixasdf', 'prefix', 'prefixxxx']
        self.assertEqual(sharedPrefix(args), 'p')

        args = ['one', 'two']
        self.assertEqual(sharedPrefix(args), '')

        args = ['hi']
        self.assertEqual(sharedPrefix(args), 'hi')
Exemple #2
0
 def depth(self):
     vals = self.nodes.values()
     sp = sharedPrefix([bytesToBitString(n.id) for n in vals])
     return len(sp)
Exemple #3
0
 def depth(self):
     sp = sharedPrefix([n.id for n in self.nodes.values()])
     return len(sp)
Exemple #4
0
 def depth(self):
     sp = sharedPrefix([n.id for n in self.nodes.values()])
     return len(sp)