def test_asia_earthquakes(self): storage = web.Storage() storage.continent = 'AS' storage.natural_hazard='earthquake' query = Query(storage) countries = query.execute() self.assertIsInstance(countries, list)
def test_enclave(self): storage = web.Storage() storage.enclave = 1 query = Query(storage) countries = query.execute() self.assertIsInstance(countries, list) self.assertEqual(len(countries), 3)
def test_africa_political_parties_greater_than_10(self): storage = web.Storage() storage.continent = 'AF' storage.political_party_count_gt_n = 10 query = Query(storage) countries = query.execute() self.assertIsInstance(countries, list)
def test_na_flag_contains_color_orange(self): storage = web.Storage() storage.continent = 'NA' storage.flag_contains_color = 'orange' query = Query(storage) countries = query.execute() self.assertIsInstance(countries, list) self.assertEqual(len(countries), 2)
async def download( # query = { # 'query': { # 'range': { # 'timestamp': { # 'format': 'strict_date_optional_time', # 'gte': 'now-3M', # 'lte': 'now' # } # } # } # } query: Query = Query( query = { 'range': { 'timestamp': { 'format': 'strict_date_optional_time', 'gte': 'now-3M', 'lte': 'now' } } }) ): es = Elasticsearch_API() response = {} # pprint(query) # try: # first get the es response response = await es.post(query) # pprint(response) await es.close() # print(response) # except: # print("Elasticsearch post failed") # try: # # parse the response # response = transform.to_ocpapp(response) # print(response) # except: # print("Error parsing Elasticsearch response") # print(response) # pprint(response['hits']['hits']) # pprint(transform.extract_to_long_df(response['hits']['hits'])) response = transform.to_ocpapp(response) # pprint(response) return response
def test_capital_coordinates(self): storage = web.Storage() storage.capital_coordinates = 10 query = Query(storage) result = query.execute() self.assertIsInstance(result, list)