Ejemplo n.º 1
0
 def test_one_part(self):
     utils.split_file_by_parts(self.testfile, 1)
     FAKEOPEN.assert_called_once_with('testfile-1.txt', 'w')
     self.assertEqual(
             FAKEFILE.method_calls,
             [call.writelines(self.lines), call.close()]
     )
Ejemplo n.º 2
0
 def _make_expected_write_calls(self, lines, lines_per_file,
                                header=False):
     expected_write_calls = []
     start_line = 1 if header else 0
     for i in range(start_line, len(lines), lines_per_file):
         if header:
             expected_write_calls.append(call.write(self.lines[0]))
         expected_write_calls.append(
                 call.writelines(lines[i:i+lines_per_file]))
         expected_write_calls.append(call.close())
     return expected_write_calls