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