예제 #1
0
 def testCsvfl_csvToDataFrame_3(self):
     data_expected = pandas.DataFrame()
     result, msg, data_actual, countRows, countColumns = csvfl_csvToDataFrame(
         csvFullPath, 2)
     self.assertEqual((-1, "Error : An unexpected error occurred.", 0, 0),
                      (result, msg, countRows, countColumns))
     assert_frame_equal(data_expected, data_actual)
예제 #2
0
 def testCsvfl_csvToDataFrame_7(self):
     data_expected = pandas.DataFrame()
     result, msg, data_actual, countRows, countColumns = csvfl_csvToDataFrame(
         csvFullPathInvalid, 1)
     self.assertEqual((0, "Error : Invalid CSV file format.", 0, 0),
                      (result, msg, countRows, countColumns))
     assert_frame_equal(data_expected, data_actual)
예제 #3
0
 def testCsvfl_csvToDataFrame_6(self):
     data_expected = pandas.DataFrame()
     result, msg, data_actual, countRows, countColumns = csvfl_csvToDataFrame(
         csvFullPathEmpty, 1)
     self.assertEqual((0, "Error : The file specified was empty.", 0, 0),
                      (result, msg, countRows, countColumns))
     assert_frame_equal(data_expected, data_actual)
예제 #4
0
 def testCsvfl_csvToDataFrame_4(self):
     data_expected = pandas.DataFrame()
     result, msg, data_actual, countRows, countColumns = csvfl_csvToDataFrame(
         csvFullPathNotExist, 1)
     self.assertEqual((0, r"Error : Cannot find the CSV file specified. [" +
                       csvFullPathNotExist + "]", 0, 0),
                      (result, msg, countRows, countColumns))
     assert_frame_equal(data_expected, data_actual)
예제 #5
0
    def testCsvfl_csvToDataFrame_9(self):
        data_expected = pandas.DataFrame([[
            "集計日", "教科", "設問番号", "設問種別", "マーク値", "取込済解答数", "当日取込全数", "白紙検出数",
            "採点完了件数"
        ], ["2017-06-25", "国", "2", "M", "", "12893", "0", "0", "12893"
            ], ["2017-06-25", "国", "3", "短", "", "12893", "0", "0", "0"]],
                                         columns=[1, 2, 3, 4, 5, 6, 7, 8, 9])

        result, msg, data_actual, countRows, countColumns = csvfl_csvToDataFrame(
            csvFullPath, 0)
        self.assertEqual((1, "Complete.", 4, 9),
                         (result, msg, countRows, countColumns))
        assert_frame_equal(data_expected, data_actual)
예제 #6
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))