Esempio n. 1
0
 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)
Esempio n. 2
0
 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
Esempio n. 3
0
 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
Esempio n. 4
0
 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)
Esempio n. 5
0
 def test_aws_parsing(self):
     parsed = parsing.parse_file(self.testfile)
     self.assertTrue(len(parsed.columns), 11)
Esempio n. 6
0
 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
Esempio n. 7
0
 def test_aws_parsing(self):
     parsed = parsing.parse_file(self.testfile)
     self.assertTrue(len(parsed.columns), 11)
Esempio n. 8
0
 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