def test_freq_stat_1(self): # case 1 data_month1 = gf.data_extract(self.data, 2014, 1, 2014, 1) loc_data1 = fs.station_info(data_month1, 2014, 1) stat_list1 = fs.high_freq_station(loc_data1, 2) self.assertEqual(set(stat_list1), set(['Pershing Square N', '8 Ave & W 31 St'])) # case 2 data_month2 = gf.data_extract(self.data, 2015, 1, 2015, 1) loc_data2 = fs.station_info(data_month2, 2015, 1) stat_list2 = fs.high_freq_station(loc_data2, 3) self.assertEqual( set(stat_list2), set([ '8 Ave & W 31 St', 'Lafayette St & E 8 St', 'E 43 St & Vanderbilt Ave' ])) # case 3 data_month3 = gf.data_extract(self.data, 2013, 12, 2013, 12) loc_data3 = fs.station_info(data_month3, 2013, 12) stat_list3 = fs.high_freq_station(loc_data3, 5) self.assertEqual( set(stat_list3), set([ '8 Ave & W 31 St', 'Pershing Square N', 'W 21 St & 6 Ave', 'E 17 St & Broadway', '8 Ave & W 33 St' ]))
def test_freq_stat_1(self): # case 1 data_month1 = gf.data_extract(self.data, 2014, 1, 2014, 1) loc_data1 = fs.station_info(data_month1, 2014, 1) stat_list1 = fs.high_freq_station(loc_data1, 2) self.assertEqual(set(stat_list1), set(['Pershing Square N', '8 Ave & W 31 St'])) # case 2 data_month2 = gf.data_extract(self.data, 2015, 1, 2015, 1) loc_data2 = fs.station_info(data_month2, 2015, 1) stat_list2 = fs.high_freq_station(loc_data2, 3) self.assertEqual(set(stat_list2), set(['8 Ave & W 31 St', 'Lafayette St & E 8 St', 'E 43 St & Vanderbilt Ave'])) # case 3 data_month3 = gf.data_extract(self.data, 2013, 12, 2013, 12) loc_data3 = fs.station_info(data_month3, 2013, 12) stat_list3 = fs.high_freq_station(loc_data3, 5) self.assertEqual(set(stat_list3), set(['8 Ave & W 31 St', 'Pershing Square N', 'W 21 St & 6 Ave', 'E 17 St & Broadway', '8 Ave & W 33 St']))
def setUp(self): # load data try: self.data = pd.read_csv('data/Citibike_final.csv') except IOError: print "can not find the data file, Goodbye" sys.exit() data_month = gf.data_extract(self.data, 2014, 1, 2014, 1) loc_data = fs.station_info(data_month, 2014, 1) self.map_plot_obj = sm.MapPlot(loc_data,1,2014)
def setUp(self): # load data try: self.data = pd.read_csv('data/Citibike_final.csv') except IOError: print "can not find the data file, Goodbye" sys.exit() data_month = gf.data_extract(self.data, 2014, 1, 2014, 1) loc_data = fs.station_info(data_month, 2014, 1) self.map_plot_obj = sm.MapPlot(loc_data, 1, 2014)
def test_plottingTool_2(self): data_month = gf.data_extract(self.data, 2015, 3, 2015, 3) month_data = vs.visualizationTool(data_month, 2015, 3) self.assertEqual(month_data.year, 2015) self.assertEqual(month_data.month, 3)
def test_plottingTool_1(self): data_month = gf.data_extract(self.data, 2014, 1, 2014, 1) month_data = vs.visualizationTool(data_month, 2014, 1) self.assertEqual(month_data.year, 2014) self.assertEqual(month_data.month, 1)