Skip to content

Commit

Permalink
additional tests - 100%
Browse files Browse the repository at this point in the history
  • Loading branch information
cleder committed Nov 13, 2024
1 parent 104aa6d commit 346e676
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tests/hypothesis/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ def assert_repr_roundtrip(obj: _XMLObject) -> None:
"""Test that repr(obj) can be eval'd back to obj."""
try:
assert obj == eval(repr(obj), {}, eval_locals) # noqa: S307
except FileNotFoundError:
except FileNotFoundError: # pragma: no cover
# The timezone file may not be available on all systems.
logger.exception("Failed to eval repr(obj).")
logger.exception("Failed to eval repr(obj).") # pragma: no cover


def assert_str_roundtrip(obj: _XMLObject) -> None:
Expand Down
4 changes: 2 additions & 2 deletions tests/hypothesis/multi_geometry_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ def _test_geometry_str_roundtrip_verbose(
assert geometry.geometry
assert type(new_g.geometry) is cls
for new, orig in zip(new_g.kml_geometries, geometry.kml_geometries):
if isinstance(new, fastkml.geometry.MultiGeometry):
continue
if isinstance(new, fastkml.geometry.MultiGeometry): # pragma: no cover
continue # pragma: no cover
assert not isinstance(orig, fastkml.geometry.MultiGeometry)
if extrude:
assert new.extrude == orig.extrude == extrude
Expand Down
11 changes: 11 additions & 0 deletions tests/times_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,17 @@ def test_read_timestamp_invalid(self) -> None:

assert ts.timestamp is None

def test_read_timestamp_empty(self) -> None:
doc = """
<TimeStamp>
<when></when>
</TimeStamp>
"""

ts = kml.TimeStamp.from_string(doc, ns="")

assert ts.timestamp is None

def test_read_timestamp_utc(self) -> None:
# dateTime (YYYY-MM-DDThh:mm:ssZ)
# Here, T is the separator between the calendar and the hourly notation
Expand Down

0 comments on commit 346e676

Please sign in to comment.