From abcc0d9d96d4367515febd1b99cb4f8dd5003bb6 Mon Sep 17 00:00:00 2001 From: Christian Ledermann Date: Sun, 1 Dec 2024 20:38:29 +0000 Subject: [PATCH] add test for handling invalid location in model --- tests/model_test.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/model_test.py b/tests/model_test.py index 93a4ff53..fb10c150 100644 --- a/tests/model_test.py +++ b/tests/model_test.py @@ -47,6 +47,7 @@ def test_from_string(self) -> None: ) model = fastkml.model.Model.from_string(doc) + assert model.altitude_mode == AltitudeMode.absolute assert model.geometry == Point( -123.115776547816, @@ -95,6 +96,7 @@ def test_from_string_no_location(self) -> None: ) model = fastkml.model.Model.from_string(doc) + assert model.altitude_mode == AltitudeMode.absolute assert model.geometry is None assert not model @@ -120,10 +122,27 @@ def test_from_string_invalid_location(self) -> None: ) model = fastkml.model.Model.from_string(doc) + assert model.altitude_mode == AltitudeMode.absolute assert model.geometry is None assert not model + def test_location_from_string_invalid_location(self) -> None: + doc = ( + '' + "" + "49.279804095564" + "21.614010375743" + "" + ) + + location = fastkml.model.Location.from_string(doc) + + assert location.altitude == 21.614010375743 + assert location.latitude == 49.279804095564 + assert location.geometry is None + assert not location + class TestModelLxml(TestModel, Lxml): pass