예제 #1
0
 def testCsvTuplePrinterMustCloseTheOutputFileWhenCommanded(self):
     csv_tuple_printer = CsvTuplePrinter()
     output_file = Mock()
     csv_tuple_printer.output_file = output_file
     
     csv_tuple_printer.close()
     
     output_file.close.assert_called()
예제 #2
0
 def testCsvTuplePrinterMustRecieveOneTupleAndPrintItToTheOutputFile(self):
     csv_tuple_printer = CsvTuplePrinter()
     output_file = Mock()
     csv_tuple_printer.output_file = output_file
     a_tuple = ("field1", "field2", 0)
     
     csv_tuple_printer.put(a_tuple)
     
     stringified_tuple = str(a_tuple[0]) + "," + str(a_tuple[1]) + "," + str(a_tuple[2]) + "\n"
     output_file.write.assert_called_with(stringified_tuple)