From b8adec883cb75fb6944a773545e7704e6130685c Mon Sep 17 00:00:00 2001
From: Sourcery AI <>
Date: Sat, 25 Nov 2023 16:38:14 +0000
Subject: [PATCH] 'Refactored by Sourcery'
---
fastkml/features.py | 8 ++------
tests/oldunit_test.py | 6 +++---
2 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/fastkml/features.py b/fastkml/features.py
index 7f7b059d..2259d544 100644
--- a/fastkml/features.py
+++ b/fastkml/features.py
@@ -202,9 +202,7 @@ def style_url(self) -> Optional[str]:
Returns the url only, not a full StyleUrl object.
if you need the full StyleUrl object use _style_url.
"""
- if isinstance(self._style_url, StyleUrl):
- return self._style_url.url
- return None
+ return self._style_url.url if isinstance(self._style_url, StyleUrl) else None
@style_url.setter
def style_url(self, styleurl: Union[str, StyleUrl, None]) -> None:
@@ -537,9 +535,7 @@ def __init__(
@property
def geometry(self) -> Optional[AnyGeometryType]:
- if self._geometry is not None:
- return self._geometry.geometry
- return None
+ return self._geometry.geometry if self._geometry is not None else None
def etree_element(
self,
diff --git a/tests/oldunit_test.py b/tests/oldunit_test.py
index 8a324096..51915156 100644
--- a/tests/oldunit_test.py
+++ b/tests/oldunit_test.py
@@ -522,14 +522,14 @@ def test_from_wrong_string(self) -> None:
pytest.raises(TypeError, kml.KML.class_from_string, "")
def test_from_string_with_unbound_prefix(self) -> None:
- doc = """
+ if LXML:
+ config.set_etree_implementation(lxml.etree)
+ doc = """
image.png
"""
- if LXML:
- config.set_etree_implementation(lxml.etree)
k = kml.KML.class_from_string(doc)
assert len(list(k.features())) == 1