Exemplo n.º 1
0
    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')
Exemplo n.º 2
0
    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'
Exemplo n.º 3
0
    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')
Exemplo n.º 4
0
 def depth(self):
     vals = self.nodes.values()
     sprefix = shared_prefix([bytes_to_bit_string(n.id) for n in vals])
     return len(sprefix)
Exemplo n.º 5
0
 def depth(self):
     vals = self.nodes.values()
     sprefix = shared_prefix([bytes_to_bit_string(n.id) for n in vals])
     return len(sprefix)