def test_shared_prefix(self): args = ['prefix', 'prefixasdf', 'prefix', 'prefixxxx'] self.assertEqual(shared_prefix(args), 'prefix') args = ['p', 'prefixasdf', 'prefix', 'prefixxxx'] self.assertEqual(shared_prefix(args), 'p') args = ['one', 'two'] self.assertEqual(shared_prefix(args), '') args = ['hi'] self.assertEqual(shared_prefix(args), 'hi')
def test_shared_prefix(self): # pylint: disable=no-self-use args = ['prefix', 'prefixasdf', 'prefix', 'prefixxxx'] assert shared_prefix(args) == 'prefix' args = ['p', 'prefixasdf', 'prefix', 'prefixxxx'] assert shared_prefix(args) == 'p' args = ['one', 'two'] assert shared_prefix(args) == '' args = ['hi'] assert shared_prefix(args) == 'hi'
def depth(self): vals = self.nodes.values() sprefix = shared_prefix([bytes_to_bit_string(n.id) for n in vals]) return len(sprefix)