def testCsvfl_dataFrameToCsv_13(self): result, msg, newName = csvfl.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))
def testCsvfl_dataFrameToCsv_17(self): result, msg, newName = csvfl.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'))
def testPerformance(self): # function csvToDataFrame start = time.time() result, msg, data_actual, countRows, countColumns = csvfl.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.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))
def testCsvfl_dataFrameToCsv_16(self): result, msg, newName = csvfl.csvfl_dataFrameToCsv( self.source, 1, True, dataDir, csvOutput) self.assertEqual((1, "Complete.", csvOutput), (result, msg, newName))
def testCsvfl_dataFrameToCsv_12(self): result, msg, newName = csvfl.csvfl_dataFrameToCsv( self.source, 1, True, dataDir, "") self.assertEqual((0, "Error : Invalid CSV file name. []", ""), (result, msg, newName))
def testCsvfl_dataFrameToCsv_10(self): result, msg, newName = csvfl.csvfl_dataFrameToCsv( self.source, 1, True, dataDir, 123) self.assertEqual((-1, "Error : An unexpected error occurred.", 123), (result, msg, newName))
def testCsvfl_dataFrameToCsv_9(self): result, msg, newName = csvfl.csvfl_dataFrameToCsv( self.source, 1, True, dataDirErr, csvOutput) self.assertEqual( (0, r"Error : Cannot find the directory specified. [" + dataDirErr + "]", csvOutput), (result, msg, newName))
def testCsvfl_dataFrameToCsv_6(self): result, msg, newName = csvfl.csvfl_dataFrameToCsv( self.source, 1, 3, dataDir, csvOutput) self.assertEqual( (-1, "Error : An unexpected error occurred.", csvOutput), (result, msg, newName))
def testCsvfl_dataFrameToCsv_2(self): result, msg, newName = csvfl.csvfl_dataFrameToCsv( self.source_empty, 1, True, dataDir, csvOutput) self.assertEqual((0, "Error : The source was empty.", csvOutput), (result, msg, newName))
def testCsvfl_dataFrameToCsv_1(self): result, msg, newName = csvfl.csvfl_dataFrameToCsv( self.source_invalid, 1, True, dataDir, csvOutput) self.assertEqual( (0, "Error : The source was invalid format.", csvOutput), (result, msg, newName))