Commit 6da05468 authored by Christian Ledermann's avatar Christian Ledermann

bugfix, more tests

parent af5d252c
...@@ -186,9 +186,9 @@ class _Feature(_BaseObject): ...@@ -186,9 +186,9 @@ class _Feature(_BaseObject):
# Placemark, or ScreenOverlay—the value for the Feature's inline # Placemark, or ScreenOverlay—the value for the Feature's inline
# style takes precedence over the value for the shared style. # style takes precedence over the value for the shared style.
_time_span = None #XXX _time_span = None
# Associates this Feature with a period of time. # Associates this Feature with a period of time.
_time_stamp = None #XXX _time_stamp = None
# Associates this Feature with a point in time. # Associates this Feature with a point in time.
#TODO Region = None #TODO Region = None
...@@ -278,7 +278,7 @@ class _Feature(_BaseObject): ...@@ -278,7 +278,7 @@ class _Feature(_BaseObject):
@end.setter @end.setter
def end(self, dt): def end(self, dt):
if self._time_span is None: if self._time_span is None:
self._time_span = TimeStamp(end=dt) self._time_span = TimeSpan(end=dt)
else: else:
if self._time_span.end is None: if self._time_span.end is None:
self._time_span.end = [dt, None] self._time_span.end = [dt, None]
......
...@@ -750,6 +750,7 @@ class DateTimeTestCase( unittest.TestCase ): ...@@ -750,6 +750,7 @@ class DateTimeTestCase( unittest.TestCase ):
self.assertTrue('end>' in f.to_string()) self.assertTrue('end>' in f.to_string())
self.assertFalse('TimeStamp>' in f.to_string()) self.assertFalse('TimeStamp>' in f.to_string())
self.assertFalse('when>' in f.to_string()) self.assertFalse('when>' in f.to_string())
# when we set a timestamp an existing timespan will be deleted
f.timeStamp = now f.timeStamp = now
self.assertTrue(now.isoformat() in f.to_string()) self.assertTrue(now.isoformat() in f.to_string())
self.assertTrue('TimeStamp>' in f.to_string()) self.assertTrue('TimeStamp>' in f.to_string())
...@@ -758,6 +759,21 @@ class DateTimeTestCase( unittest.TestCase ): ...@@ -758,6 +759,21 @@ class DateTimeTestCase( unittest.TestCase ):
self.assertFalse('TimeSpan>' in f.to_string()) self.assertFalse('TimeSpan>' in f.to_string())
self.assertFalse('begin>' in f.to_string()) self.assertFalse('begin>' in f.to_string())
self.assertFalse('end>' in f.to_string()) self.assertFalse('end>' in f.to_string())
# when we set a timespan an existing timestamp will be deleted
f.end = y2k
self.assertFalse(now.isoformat() in f.to_string())
self.assertTrue('2000-01-01' in f.to_string())
self.assertTrue('TimeSpan>' in f.to_string())
self.assertFalse('begin>' in f.to_string())
self.assertTrue('end>' in f.to_string())
self.assertFalse('TimeStamp>' in f.to_string())
self.assertFalse('when>' in f.to_string())
#We manipulate our Feature so it has timespan and stamp
ts = kml.TimeStamp(timestamp=now)
f._time_stamp = ts
self.assertRaises(ValueError, f.to_string)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment