Esempio 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')
Esempio 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'
Esempio 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')
Esempio 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)
Esempio 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)