def test_ls_browse(): ls = LS(api_key=LS_API_KEY) result = ls.browse( center=[19.1663, 72.8526], radius=9000, limit=5, categories=[ PLACES_CATEGORIES.historical_monument, PLACES_CATEGORIES.museum, PLACES_CATEGORIES.park_recreation_area, PLACES_CATEGORIES.leisure, PLACES_CATEGORIES.shopping_mall, ], lang="en", ) assert len(result.items) == 5 result2 = ls.browse( center=[19.1663, 72.8526], name="starbucks", country_codes=["IND"], limit=10, categories=[PLACES_CATEGORIES.restaurant], lang="en", ) assert len(result2.items) == 10 result3 = ls.browse( center=[19.1663, 72.8526], name="starbucks", bounding_box=[13.08836, 52.33812, 13.761, 52.6755], categories=[PLACES_CATEGORIES.restaurant], lang="en", ) assert len(result3.items) == 13 with pytest.raises(ApiError): ls2 = LS(api_key="dummy") ls2.browse( center=[19.1663, 72.8526], radius=9000, limit=5, categories=[ PLACES_CATEGORIES.historical_monument, PLACES_CATEGORIES.museum, PLACES_CATEGORIES.park_recreation_area, PLACES_CATEGORIES.leisure, PLACES_CATEGORIES.shopping_mall, ], )
def test_ls_browse(): ls = LS(api_key=LS_API_KEY) result = ls.browse( center=[19.1663, 72.8526], radius=9000, limit=5, categories=[ "300-3000-0025", "300-3100.550-5510-0202", "500-5520,600-6100-0062" ], lang="en", ) assert len(result.items) == 5 result2 = ls.browse( center=[19.1663, 72.8526], name="starbucks", country_codes=["IND"], limit=10, categories=["100-1000-0000"], lang="en", ) assert len(result2.items) == 10 result3 = ls.browse( center=[19.1663, 72.8526], name="starbucks", bounding_box=[13.08836, 52.33812, 13.761, 52.6755], categories=["100-1000-0000"], lang="en", ) assert len(result3.items) == 20 with pytest.raises(ApiError): ls2 = LS(api_key="dummy") ls2.browse( center=[19.1663, 72.8526], radius=9000, limit=5, categories=[ "300-3000-0025", "300-3100.550-5510-0202", "500-5520,600-6100-0062" ], )