def test_to_local_fallback(self): self.assertTrue( timezone.to_local_fallback( make_aware(datetime.utcnow(), timezone.utc)), ) self.assertTrue( timezone.to_local_fallback(datetime.utcnow()) )
def aware_tstamp(secs): """Event timestamps uses the local timezone.""" return timezone.to_local_fallback(datetime.fromtimestamp(secs))