diff --git a/tests/test_api.py b/tests/test_api.py index 4e0cb4c89b9..757ba396e3e 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -32,6 +32,16 @@ class API(overpass.API): def _get_from_overpass(self, query): return pickle.load(open(os.path.join(os.path.dirname(__file__), "example.response"), "rb")) + # The commented code should only be executed once when major changes to the Overpass API and/or to this wrapper are + # introduced. One than has to manually verify that the date in the example.response file from the Overpass API + # matches the data in the example.json file generated by this wrapper. + # + # The reason for this approach is the following: It is not safe to make calls to the actual API in this test as the + # API might momentarily be unavailable and the underlying data can also change at any moment. The commented code is + # needed to create the example.response and example.json files. The example.response file is subsequently used to + # fake the _get_from_overpass method during the tests and the example.json file is the reference that we are + # asserting against. + # # api = overpass.API() # osm_geo = api.get("rel(6518385);out body geom;way(10322303);out body geom;node(4927326183);", verbosity='body geom') # pickle.dump(api._get_from_overpass("[out:json];rel(6518385);out body geom;way(10322303);out body geom;node(4927326183);out body geom;"),