Skip to content

Commit 5acb43f

Browse files
committed
test - Additional xml tests
1 parent d5e535a commit 5acb43f

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/test_xml.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,28 @@ def test_way_missing_data(self):
171171
overpy.Way.from_xml(node)
172172

173173

174+
class TestParser(BaseTestNodes):
175+
def test_exception(self):
176+
with pytest.raises(overpy.exception.OverPyException):
177+
overpy.Result.from_xml(123)
178+
179+
def test_xml_element(self):
180+
import xml.etree.ElementTree as ET
181+
data = read_file("xml/node-01.xml")
182+
root = ET.fromstring(data)
183+
result = overpy.Result.from_xml(root)
184+
185+
assert isinstance(result, overpy.Result)
186+
self._test_node01(result)
187+
188+
def test_xml_autodetect_parser(self):
189+
data = read_file("xml/node-01.xml")
190+
result = overpy.Result.from_xml(data)
191+
192+
assert isinstance(result, overpy.Result)
193+
self._test_node01(result)
194+
195+
174196
class TestRemark(object):
175197
def test_remark_runtime_error(self):
176198
api = overpy.Overpass()

0 commit comments

Comments
 (0)