Skip to content

Commit

Permalink
Merge pull request #282 from cleder/sourcery/develop
Browse files Browse the repository at this point in the history
1.0 alpha 8 (Sourcery refactored)
  • Loading branch information
cleder committed Nov 25, 2023
2 parents 1264e2a + b8adec8 commit 9966ac0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
8 changes: 2 additions & 6 deletions fastkml/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions tests/oldunit_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,14 +522,14 @@ def test_from_wrong_string(self) -> None:
pytest.raises(TypeError, kml.KML.class_from_string, "<xml></xml>")

def test_from_string_with_unbound_prefix(self) -> None:
doc = """<kml xmlns="http://www.opengis.net/kml/2.2">
if LXML:
config.set_etree_implementation(lxml.etree)
doc = """<kml xmlns="http://www.opengis.net/kml/2.2">
<Placemark>
<ExtendedData>
<lc:attachment>image.png</lc:attachment>
</ExtendedData>
</Placemark> </kml>"""
if LXML:
config.set_etree_implementation(lxml.etree)
k = kml.KML.class_from_string(doc)
assert len(list(k.features())) == 1

Expand Down

0 comments on commit 9966ac0

Please sign in to comment.