Ejemplo n.º 1
0
 def test_data_folder_mac(self):
         
     test_input = [
         {"input": "fiets", "result": "fiets/", "test": "equal"},
         {"input": "fiets/", "result": "fiets/", "test": "equal"},
         {"input": "c:/data/", "result": "c:/data/", "test": "equal"},
         {"input": "/Users/robbert/Desktop/", "result": "/Users/robbert/Desktop/", "test": "equal"},
     ]
     
     for i in range(len(test_input)):
         x = DCC.dataclass("test class")
         x.data_folder = test_input[i]["input"]
         res = x.data_folder
         if test_input[i]["test"] == "equal":
             self.assertEqual(res, test_input[i]["result"])
         elif test_input[i]["test"] == "not equal":
             self.assertNotEqual(res, test_input[i]["result"])
         else:
             print("Invalid test")
Ejemplo n.º 2
0
    def test_construct_file_paths(self):
    
        test_input = [
            {"data_folder": "data/",
            "date": "20150102",
            "basename": "azide",
            "timestamp": "123456",
            "extension": ".csv",
            "res_base_folder": "data/20150102/azide_123456/",
            "res_base_filename": "data/20150102/azide_123456/azide_123456", 
            "test": "equal"}, 
        ]
        
        for i in range(len(test_input)):
            x = DCC.dataclass("test class")
            
            x.data_folder = test_input[i]["data_folder"]
            x.date = test_input[i]["date"]
            x.basename = test_input[i]["basename"]
            x.timestamp = test_input[i]["timestamp"]

            res = x._file_dict["base_folder"]
            if test_input[i]["test"] == "equal":
                self.assertEqual(res, test_input[i]["res_base_folder"])
            elif test_input[i]["test"] == "not equal":
                self.assertNotEqual(res, test_input[i]["res_base_folder"])
            else:
                print("Invalid test")        

            res = x._file_dict["base_filename"]
            if test_input[i]["test"] == "equal":
                self.assertEqual(res, test_input[i]["res_base_filename"])
            elif test_input[i]["test"] == "not equal":
                self.assertNotEqual(res, test_input[i]["res_base_filename"])
            else:
                print("Invalid test")