forked from mvexel/overpass-api-python-wrapper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_api.py
27 lines (21 loc) · 864 Bytes
/
test_api.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import overpass
class TestAPI(object):
def test_initialize_api(self):
api = overpass.API()
assert isinstance(api, overpass.API)
assert api.debug is False
def test_geojson(self):
api = overpass.API()
#osm_elements = api.Get(overpass.MapQuery(37.86517,-122.31851,37.86687,-122.31635))
#print 'DEB osm_elements:', geojson.dumps(osm_elements,sort_keys=True,indent=2)
osm_geo = api.Get(overpass.MapQuery(37.86517, -122.31851, 37.86687, -122.31635), asGeoJSON=True)
#with open('test.geojson','w') as f:
# geojson.dump(osm_geo,f,indent=2,sort_keys=True)
assert len(osm_geo['features']) > 1
def run_tests(self):
self.test_initialize_api()
self.test_geojson()
if __name__ == '__main__':
tapi = TestAPI()
tapi.run_tests()
print("overpass PASS")