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')
def depth(self): vals = self.nodes.values() sp = sharedPrefix([bytesToBitString(n.id) for n in vals]) return len(sp)
def depth(self): sp = sharedPrefix([n.id for n in self.nodes.values()]) return len(sp)