Skip to content

Commit e4f15af

Browse files
committed
test - pickle and unpickle the Result() object (Refs #58)
1 parent 4b5ace5 commit e4f15af

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/test_result.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import overpy
44

5+
from tests.base_class import BaseTestWay
56
from tests import read_file, new_server_thread, stop_server_thread, BaseHTTPRequestHandler
67

78

@@ -109,6 +110,23 @@ def test_missing_resolvable(self):
109110
stop_server_thread(server)
110111

111112

113+
class TestPickle(BaseTestWay):
114+
def test_way02(self):
115+
"""
116+
Try to pickle and unpickle the result object
117+
"""
118+
import pickle
119+
120+
api = overpy.Overpass()
121+
result = api.parse_json(read_file("json/way-02.json"))
122+
self._test_way02(result)
123+
# do pickle and unpickle
124+
result_string = pickle.dumps(result)
125+
new_result = pickle.loads(result_string)
126+
# test new result
127+
self._test_way02(new_result)
128+
129+
112130
class TestRelation(object):
113131
def test_missing_unresolvable(self):
114132
url, server = new_server_thread(HandleResponseJSON02)

0 commit comments

Comments
 (0)