示例#1
0
 def test_print(self):
     start_time = '1/1/2015 13:00:00'
     final_time = '1/2/2015'
     # Instantiate weather object
     prices = exodata.PriceFromDF(self.df, \
                                  self.variable_map)
     # Get price data
     prices.collect_data(start_time, final_time)
     # Check reference
     df_test = prices.display_data()
     self.check_df(df_test, 'collect_data.csv')
示例#2
0
 def setUp(self):
     self.df = pd.read_csv(
         os.path.join(self.get_unittest_path(), 'resources', 'optimization',
                      'PriceCSV.csv'))
     time = pd.to_datetime(self.df['Time'])
     self.df.set_index(time, inplace=True)
     variable_map = {
         'pi_e': ('pi_e', units.unit1)
     }
     # Instantiate weather object
     self.prices = exodata.PriceFromDF(self.df, \
                                       variable_map)
示例#3
0
 def test_collect_data_tz_handling(self):
     start_time = '1/1/2015 13:00:00'
     final_time = '1/2/2015'
     # Localize timezone
     self.df = self.df.tz_localize('UTC')
     # Instantiate weather object
     with self.assertRaises(TypeError):
         prices = exodata.PriceFromDF(self.df, \
                                      self.variable_map)
     # Remove timezone
     self.df = self.df.tz_convert(None)
     # Instantiate weather object
     prices = exodata.PriceFromDF(self.df, \
                                  self.variable_map)
     # Get control data
     prices.collect_data(start_time, final_time)
     # Collect twice
     prices.collect_data(start_time, final_time)
     # Check reference
     df_test = prices.display_data()
     self.check_df(df_test, 'collect_data.csv')