def _do_test_datetime_to_unix_timezone_change(self, expected, dt): self.assertEqual(expected, utils.datetime_to_unix(dt)) with mock.patch.dict(os.environ, {'TZ': 'UTC'}): self.assertEqual(expected, utils.datetime_to_unix(dt)) with mock.patch.dict(os.environ, {'TZ': 'Europe/Paris'}): self.assertEqual(expected, utils.datetime_to_unix(dt)) with mock.patch.dict(os.environ, {'TZ': 'US/Eastern'}): self.assertEqual(expected, utils.datetime_to_unix(dt))
def _split_key_to_string(timestamp): return str(utils.datetime_to_unix(timestamp))
def _split_key_to_string(timestamp): ts = timestamp.to_datetime() if ts.tzinfo is None: ts = ts.replace(tzinfo=iso8601.iso8601.UTC) return str(utils.datetime_to_unix(ts))
def _split_key_to_string(timestamp): ts = timestamp.to_datetime() if ts.tzinfo is None: ts = ts.replace(tzinfo=iso8601.iso8601.UTC) return str(utils.datetime_to_unix(ts))