Esempio n. 1
0
 def testCsvfl_dataFrameToCsv_17(self):
     result, msg, newName = csvfl_dataFrameToCsv(self.source, 1, False,
                                                 dataDir, csvOutput)
     self.assertEqual((1, "Complete.", "output(1).csv"),
                      (result, msg, newName))
     if os.path.isfile(os.path.join(dataDir, 'output(1).csv')):
         os.unlink(os.path.join(dataDir, 'output(1).csv'))
Esempio n. 2
0
 def testCsvfl_dataFrameToCsv_13(self):
     result, msg, newName = csvfl_dataFrameToCsv(self.source, 1, True,
                                                 dataDir, csv_not_write)
     self.assertEqual(
         (0, r"Error : Cannot create or save this file. [" +
          os.path.join(dataDir, csv_not_write) + "]", csv_not_write),
         (result, msg, newName))
Esempio n. 3
0
    def testPerformance(self):
        # function csvToDataFrame
        start = time.time()
        result, msg, data_actual, countRows, countColumns = csvfl_csvToDataFrame(
            csvFullPathLarge, 1)
        end = time.time()
        self.assertEqual((1, "Complete."), (result, msg))
        print("Time test function Csvfl_csvToDataFrame: " + str(end - start))

        # function csvfl_dataFrameToCsv
        start = time.time()
        result, msg, newName = csvfl_dataFrameToCsv(data_actual, 1, True,
                                                    dataDir,
                                                    csvOutputLargeData)
        end = time.time()
        self.assertEqual((1, "Complete.", csvOutputLargeData),
                         (result, msg, newName))
        print("Time test function Csvfl_dataFrameToCsv: " + str(end - start))
Esempio n. 4
0
 def testCsvfl_dataFrameToCsv_16(self):
     result, msg, newName = csvfl_dataFrameToCsv(self.source, 1, True,
                                                 dataDir, csvOutput)
     self.assertEqual((1, "Complete.", csvOutput), (result, msg, newName))
Esempio n. 5
0
 def testCsvfl_dataFrameToCsv_11(self):
     result, msg, newName = csvfl_dataFrameToCsv(self.source, 1, True,
                                                 dataDir, csv_invalid)
     self.assertEqual(
         (0, "Error : Invalid CSV file name. [" + csv_invalid + "]",
          csv_invalid), (result, msg, newName))
Esempio n. 6
0
 def testCsvfl_dataFrameToCsv_12(self):
     result, msg, newName = csvfl_dataFrameToCsv(self.source, 1, True,
                                                 dataDir, "")
     self.assertEqual((0, "Error : Invalid CSV file name. []", ""),
                      (result, msg, newName))
Esempio n. 7
0
 def testCsvfl_dataFrameToCsv_10(self):
     result, msg, newName = csvfl_dataFrameToCsv(self.source, 1, True,
                                                 dataDir, 123)
     self.assertEqual((-1, "Error : An unexpected error occurred.", 123),
                      (result, msg, newName))
Esempio n. 8
0
 def testCsvfl_dataFrameToCsv_9(self):
     result, msg, newName = csvfl_dataFrameToCsv(self.source, 1, True,
                                                 dataDirErr, csvOutput)
     self.assertEqual(
         (0, r"Error : Cannot find the directory specified. [" +
          dataDirErr + "]", csvOutput), (result, msg, newName))
Esempio n. 9
0
 def testCsvfl_dataFrameToCsv_6(self):
     result, msg, newName = csvfl_dataFrameToCsv(self.source, 1, 3, dataDir,
                                                 csvOutput)
     self.assertEqual(
         (-1, "Error : An unexpected error occurred.", csvOutput),
         (result, msg, newName))
Esempio n. 10
0
 def testCsvfl_dataFrameToCsv_2(self):
     result, msg, newName = csvfl_dataFrameToCsv(self.source_empty, 1, True,
                                                 dataDir, csvOutput)
     self.assertEqual((0, "Error : The source was empty.", csvOutput),
                      (result, msg, newName))
Esempio n. 11
0
 def testCsvfl_dataFrameToCsv_1(self):
     result, msg, newName = csvfl_dataFrameToCsv(self.source_invalid, 1,
                                                 True, dataDir, csvOutput)
     self.assertEqual(
         (0, "Error : The source was invalid format.", csvOutput),
         (result, msg, newName))