def test_pretty_print_most_proba_locations(self): most_proba_locations = [[], [], [], ['116.21832 40.02880', '116.21863 40.01969'], ['116.21832 40.02880', '116.21863 40.01969'], ['116.21832 40.02880', '116.21863 40.01969'], ['116.21832 40.02880', '116.21863 40.01969'], ['116.21832 40.02880', '116.21863 40.01969'], ['116.21832 40.02880', '116.21863 40.01969'], ['116.21832 40.02880', '116.21863 40.01969'], ['116.21832 40.02880', '116.21863 40.01969'], ['116.21832 40.02880', '116.21863 40.01969'], ['116.21832 40.02880', '116.21863 40.01969'], ['116.21832 40.02880', '116.21863 40.01969'], ['116.21832 40.02880', '116.21863 40.01969'], [], [], [], [], ['116.34819 39.92131'], ['116.35075 39.92321', '116.34819 39.92131'], ['116.35075 39.92321', '116.34819 39.92131'], ['116.35075 39.92321', '116.34819 39.92131'], ['116.35075 39.92321', '116.34819 39.92131'], ['116.35075 39.92321', '116.34819 39.92131'], ['116.35075 39.92321', '116.34819 39.92131'], ['116.35075 39.92321', '116.34819 39.92131'], ['116.35075 39.92321', '116.34819 39.92131'], ['116.35075 39.92321', '116.34819 39.92131'], ['116.35075 39.92321', '116.34819 39.92131'], ['116.35075 39.92321', '116.34819 39.92131'], ['116.35075 39.92321', '116.34819 39.92131'], ['116.35075 39.92321', '116.34819 39.92131'], ['116.35075 39.92321', '116.34819 39.92131'], ['116.35075 39.92321', '116.34819 39.92131'], ['116.35075 39.92321', '116.34819 39.92131'], ['116.35075 39.92321', '116.34819 39.92131'], ['116.34819 39.92131'], ['116.34819 39.92131'], [], ['116.21863 40.01969'], ['116.21863 40.01969'], ['116.21863 40.01969'], ['116.21863 40.01969'], ['116.21863 40.01969'], ['116.21863 40.01969'], ['116.21863 40.01969'], ['116.21863 40.01969']] expected = [{ 'range': [4, 15], 'locations': ['116.21832 40.02880', '116.21863 40.01969'] }, { 'range': [20, 20], 'locations': ['116.34819 39.92131'] }, { 'range': [21, 37], 'locations': ['116.35075 39.92321', '116.34819 39.92131'] }, { 'range': [38, 39], 'locations': ['116.34819 39.92131'] }, { 'range': [41, 48], 'locations': ['116.21863 40.01969'] }] self.assertEqual( gmpl.pretty_print_most_proba_locations(most_proba_locations), expected)
def most_proba_locations_holiday(uid): locations = _location_by_uid_stop_holiday(uid) matrix = generate_matrix(locations) most_proba_locations = pretty_print_most_proba_locations(get_most_proba_locations(matrix)) return make_response(dumps(most_proba_locations))
def most_proba_locations_holiday(uid): locations = _location_by_uid_stop_holiday(uid) matrix = generate_matrix(locations) most_proba_locations = pretty_print_most_proba_locations(get_most_proba_locations(matrix)) return make_response(dumps(most_proba_locations))
def test_pretty_print_most_proba_locations(self): most_proba_locations = [[], [], [], ['116.21832 40.02880', '116.21863 40.01969'], ['116.21832 40.02880', '116.21863 40.01969'], ['116.21832 40.02880', '116.21863 40.01969'], ['116.21832 40.02880', '116.21863 40.01969'], ['116.21832 40.02880', '116.21863 40.01969'], ['116.21832 40.02880', '116.21863 40.01969'], ['116.21832 40.02880', '116.21863 40.01969'], ['116.21832 40.02880', '116.21863 40.01969'], ['116.21832 40.02880', '116.21863 40.01969'], ['116.21832 40.02880', '116.21863 40.01969'], ['116.21832 40.02880', '116.21863 40.01969'], ['116.21832 40.02880', '116.21863 40.01969'], [], [], [], [], ['116.34819 39.92131'], ['116.35075 39.92321', '116.34819 39.92131'], ['116.35075 39.92321', '116.34819 39.92131'], ['116.35075 39.92321', '116.34819 39.92131'], ['116.35075 39.92321', '116.34819 39.92131'], ['116.35075 39.92321', '116.34819 39.92131'], ['116.35075 39.92321', '116.34819 39.92131'], ['116.35075 39.92321', '116.34819 39.92131'], ['116.35075 39.92321', '116.34819 39.92131'], ['116.35075 39.92321', '116.34819 39.92131'], ['116.35075 39.92321', '116.34819 39.92131'], ['116.35075 39.92321', '116.34819 39.92131'], ['116.35075 39.92321', '116.34819 39.92131'], ['116.35075 39.92321', '116.34819 39.92131'], ['116.35075 39.92321', '116.34819 39.92131'], ['116.35075 39.92321', '116.34819 39.92131'], ['116.35075 39.92321', '116.34819 39.92131'], ['116.35075 39.92321', '116.34819 39.92131'], ['116.34819 39.92131'], ['116.34819 39.92131'], [], ['116.21863 40.01969'], ['116.21863 40.01969'], ['116.21863 40.01969'], ['116.21863 40.01969'], ['116.21863 40.01969'], ['116.21863 40.01969'], ['116.21863 40.01969'], ['116.21863 40.01969']] expected = [ {'range': [4, 15], 'locations': ['116.21832 40.02880', '116.21863 40.01969']}, {'range': [20, 20], 'locations': ['116.34819 39.92131']}, {'range': [21, 37], 'locations': ['116.35075 39.92321', '116.34819 39.92131']}, {'range': [38, 39], 'locations': ['116.34819 39.92131']}, {'range': [41, 48], 'locations': ['116.21863 40.01969']} ] self.assertEqual(gmpl.pretty_print_most_proba_locations(most_proba_locations), expected)