Beispiel #1
0
 def testSameLengths(self):
     """
     If both files have the same number of lines but nothing in common,
     (n, n, 0) must be returned, where n is the number of lines.
     """
     self.assertEqual((2, 2, 0),
                      countCommon(lines('ABC DEF'), lines('1234 5678')))
Beispiel #2
0
 def testSecondShorterNothingInCommon(self):
     """
     If the second file is shorter than the first and nothing is in common,
     (n, m, 0) must be returned where n is the number of lines in the first
     file and m is the number in the second file.
     """
     self.assertEqual((4, 2, 0), countCommon(lines('A B C D'),
                                             lines('1 2')))
Beispiel #3
0
 def testSecondShorterSomethingInCommon(self):
     """
     If the second file is shorter than the first and there is something in
     common, (n, m, c) must be returned where n is the number of lines in
     the first file, m is the number in the second file, and c is the
     number in common.
     """
     self.assertEqual((4, 7, 2),
                      countCommon(lines('A B C D'), lines('1 2 A B 3 4 5')))
Beispiel #4
0
 def testSecondEmpty(self):
     """
     If the second file is empty, (n, 0, 0) must be returned where
     n is the number of lines in the first file.
     """
     self.assertEqual((2, 0, 0), countCommon(lines('hey you'), lines()))
Beispiel #5
0
 def testBothEmpty(self):
     """
     If both files are empty, (0, 0, 0) must be returned.
     """
     self.assertEqual((0, 0, 0), countCommon(lines(), lines()))