def test_time_change(self): i = Item('test') i.set_value('test') i._last_change.set(pd_now(UTC) - timedelta(seconds=5)) i._last_update.set(pd_now(UTC) - timedelta(seconds=5)) i.set_value('test1') self.assertGreater(i._last_update.dt, pd_now(UTC) - timedelta(milliseconds=100)) self.assertGreater(i._last_change.dt, pd_now(UTC) - timedelta(milliseconds=100))
def test_time_change(self): i = Item('test') i.set_value('test') i._last_change.set(datetime.now(tz=pytz.utc) - timedelta(seconds=5)) i._last_update.set(datetime.now(tz=pytz.utc) - timedelta(seconds=5)) i.set_value('test1') self.assertGreater( i._last_update.dt, datetime.now(tz=pytz.utc) - timedelta(milliseconds=100)) self.assertGreater( i._last_change.dt, datetime.now(tz=pytz.utc) - timedelta(milliseconds=100))
def test_time_update(self): i = Item('test') i.set_value('test') i._last_change = datetime.now(tz=pytz.utc) - timedelta(seconds=5) i._last_update = datetime.now(tz=pytz.utc) - timedelta(seconds=5) i.set_value('test') self.assertGreater( i._last_update, datetime.now(tz=pytz.utc) - timedelta(milliseconds=100)) self.assertLess( i._last_change, datetime.now(tz=pytz.utc) - timedelta(milliseconds=100))