def test_missing_file(self): file_datetime = pd.datetime(2010, 2, 24, 11, 51, 45) empty_df = pd.DataFrame({l: None for l in lines}, index=[file_datetime]).astype(float) parsed = parsing.parse_file( 's3://pivotal-london-dis/tfl_api_line_mode_status_tube_2010-02-24_11:51:45.json' ) assert_frame_equal(parsed, empty_df)
def test_single_line(self): with open(self.filepath, "w") as f: disruption = """ [{"id": "bakerloo", "lineStatuses":[{"statusSeverity":6, "statusSeverityDescription":"Severe Delays"}]}] """ f.write(disruption) result = parsing.parse_file(self.filepath) line_values = self.empty_df line_values["bakerloo"] = 6.0 assert_frame_equal(result, line_values) return
def test_single_line(self): with open(self.filepath, "w") as f: disruption = """ [{"id": "bakerloo", "lineStatuses":[{"statusSeverity":6, "statusSeverityDescription":"Severe Delays"}]}] """ f.write(disruption) result = parsing.parse_file(self.filepath) line_values = self.empty_df line_values['bakerloo'] = 6.0 assert_frame_equal(result, line_values) return
def test_missing_file(self): file_datetime = pd.datetime(2010, 2, 24, 11, 51, 45) empty_df = pd.DataFrame({l: None for l in lines}, index=[file_datetime]).astype(float) parsed = parsing.parse_file("s3://pivotal-london-dis/tfl_api_line_mode_status_tube_2010-02-24_11:51:45.json") assert_frame_equal(parsed, empty_df)
def test_aws_parsing(self): parsed = parsing.parse_file(self.testfile) self.assertTrue(len(parsed.columns), 11)
def test_empty_file(self): with open(self.filepath, "w") as f: f.write("") result = parsing.parse_file(self.filepath) self.assertTrue(result.equals(self.empty_df)) return
def test_empty_file(self): with open(self.filepath, "w") as f: f.write('') result = parsing.parse_file(self.filepath) self.assertTrue(result.equals(self.empty_df)) return