diff --git a/fastkml/gx.py b/fastkml/gx.py index 5005529c..a2884fd5 100644 --- a/fastkml/gx.py +++ b/fastkml/gx.py @@ -483,7 +483,7 @@ def __init__( ValueError: If both geometry and tracks are specified. """ - self.tracks = list(tracks) if tracks else [] + self.tracks = [t for t in tracks if t] if tracks else [] self.interpolate = interpolate super().__init__( ns=ns, diff --git a/tests/hypothesis/gx_test.py b/tests/hypothesis/gx_test.py index 962d1a63..2fb4d110 100644 --- a/tests/hypothesis/gx_test.py +++ b/tests/hypothesis/gx_test.py @@ -105,8 +105,6 @@ def test_fuzz_track_track_items( st.lists( st.builds( fastkml.gx.Track, - id=st.one_of(st.none(), nc_name()), - target_id=st.one_of(st.none(), nc_name()), altitude_mode=st.one_of( st.none(), st.sampled_from(fastkml.enums.AltitudeMode), @@ -132,10 +130,15 @@ def test_fuzz_multi_track( tracks: typing.Optional[typing.Iterable[fastkml.gx.Track]], interpolate: typing.Optional[bool], ) -> None: - fastkml.gx.MultiTrack( + multi_track = fastkml.gx.MultiTrack( id=id, target_id=target_id, altitude_mode=altitude_mode, tracks=tracks, interpolate=interpolate, ) + + assert_repr_roundtrip(multi_track) + assert_str_roundtrip(multi_track) + assert_str_roundtrip_terse(multi_track) + assert_str_roundtrip_verbose(multi_track)