def test_get_common_prefix_5(self):
     self.assertEquals(None, StringTools.get_common_prefix(()))
 def test_get_common_prefix_6(self):
     self.assertEquals((1, 2, 3), StringTools.get_common_prefix(((1,2,3),(1,2,3,4))))
 def test_get_common_prefix_4(self):
     self.assertEquals('', StringTools.get_common_prefix(('A', 'B')))
 def test_get_common_prefix_3(self):
     self.assertEquals('', StringTools.get_common_prefix(('dyn', 'prio4dyn', 'prid4dyn')))
 def test_get_common_prefix_2(self):
     self.assertEquals('', StringTools.get_common_prefix(set(('ABC', 'ABCD', 'ABCE', 'XYZ'))))
 def test_get_common_prefix_1(self):
     self.assertEquals('ABC', StringTools.get_common_prefix(iter(('ABC', 'ABCD', 'ABCE'))))
Exemple #7
0
 def common_base_directory(cls, file_paths, pathmodule=os.path):
     return StringTools.get_common_prefix(
         imap(os.path.normpath, imap(pathmodule.dirname, file_paths)))