mirror of
https://github.com/carrotquest/django-clickhouse.git
synced 2024-11-22 00:56:37 +03:00
Fixing test bug
This commit is contained in:
parent
8b9e2332db
commit
37712b4156
|
@ -54,7 +54,6 @@ def format_datetime(dt, timezone_offset=0, day_end=False, db_alias=None):
|
|||
|
||||
# Dates in ClickHouse are parsed in server local timezone. So I need to add server timezone
|
||||
server_dt = dt - datetime.timedelta(minutes=timezone_offset - get_tz_offset(db_alias))
|
||||
print(dt, timezone_offset, get_tz_offset(db_alias))
|
||||
|
||||
return server_dt.strftime("%Y-%m-%d %H:%M:%S")
|
||||
|
||||
|
|
|
@ -41,7 +41,8 @@ class FormatDateTimeTest(TestCase):
|
|||
self.assertEqual(format_datetime(dt), self._get_zone_time(dt))
|
||||
dt = datetime.datetime(2017, 1, 2, 3, 4, 5, tzinfo=pytz.timezone('Europe/Moscow'))
|
||||
offset = int(pytz.timezone('Europe/Moscow').utcoffset(dt).total_seconds() / 60)
|
||||
self.assertEqual(format_datetime(dt, timezone_offset=offset), '2017-01-02 03:04:05')
|
||||
self.assertEqual(format_datetime(dt, timezone_offset=offset),
|
||||
local_dt_str(datetime.datetime(2017, 1, 2, 3, 4, 5) - datetime.timedelta(minutes=offset*2)))
|
||||
|
||||
def test_date_conversion(self):
|
||||
dt = datetime.date(2017, 1, 2)
|
||||
|
|
Loading…
Reference in New Issue
Block a user