def test_data_hour_columns(self): data_dict = app_test.create_dataDict_from_API() data_hour_raw = data_dict['data_hour'] header_hour = app_test.create_header_hour(data_dict) data_hour = app_test.pull_data_hour_API(data_hour_raw, header_hour) for row in data_hour: self.assertTrue(len(tuple(row)) == 10, 'message')
def DB_insert_daily_data(): data_dict = app_test.create_dataDict_from_API() data_daily_raw = data_dict['data_daily'] data_daily = app_test.pull_data_daily_API(data_daily_raw) header_daily = app_test.create_header_daily(data_dict) strExe = app_test.create_str_pull_daily_data(header_daily) conn = sqlite3.connect('DB_weather.sqlite') cur = conn.cursor() for row in data_daily: cur.execute(strExe, tuple(row)) conn.commit() cur.close()
def DB_insert_hour_data(): data_dict = app_test.create_dataDict_from_API() data_hour_raw = data_dict['data_hour'] header_hour = app_test.create_header_hour(data_dict) strExe = app_test.create_str_pull_hour_data(header_hour) data_hour_list = list() row_data_hour = list() for row in data_hour_raw: for header in header_hour: row_data_hour.append(data_hour_raw[row][header]) data_hour_list.append(row_data_hour) row_data_hour = list() conn = sqlite3.connect('DB_weather.sqlite') cur = conn.cursor() for row in data_hour_list: cur.execute(strExe, tuple(row)) conn.commit() cur.close()
def test_strExe_info_is_str(self): data_dict = app_test.create_dataDict_from_API() header_info = app_test.create_header_hour(data_dict) strExe = app_test.create_str_pull_info_data(header_info) self.assertTrue(isinstance(strExe, str), 'message')
def test_type_input(self): data_dict = app_test.create_dataDict_from_API() self.assertTrue(isinstance(data_dict, dict), 'message')
def test_header_hour_columns(self): data_dict = app_test.create_dataDict_from_API() header_hour = app_test.create_header_hour(data_dict) self.assertTrue(len(header_hour) == 10, 'message')
def test_strExe_Daily_is_str(self): data_dict = app_test.create_dataDict_from_API() header_daily = app_test.create_header_daily(data_dict) strExe = app_test.create_str_pull_daily_data(header_daily) self.assertTrue(isinstance(strExe, str), 'message')
def test_data_daily_columns(self): data_dict = app_test.create_dataDict_from_API() data_daily_raw = data_dict['data_daily'] data_daily = app_test.pull_data_daily_API(data_daily_raw) for row in data_daily: self.assertTrue(len(tuple(row)) == 14, 'message')
def test_header_daily_columns(self): data_dict = app_test.create_dataDict_from_API() header_daily = app_test.create_header_daily(data_dict) self.assertTrue(len(header_daily) == 14, 'message')
def test_dict_data_info_exist(self): data_dict = app_test.create_dataDict_from_API() self.assertTrue('data_info' in data_dict, 'message')
def test_len_dict_data(self): data_dict = app_test.create_dataDict_from_API() self.assertTrue(len(data_dict) == 3, 'message')