Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed failed unit tests caused by using pytz inappropriately #621

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions tests/test_fields.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from collections import OrderedDict
from datetime import date, datetime
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal
from functools import partial

Expand All @@ -10,6 +10,9 @@
from flask_restx import fields, Api


_CET_TIMEZONE = timezone(timedelta(hours=1), "CET")


class FieldTestCase(object):
field_class = None

Expand Down Expand Up @@ -542,7 +545,7 @@ def test_max_exclusive(self):
"Sat, 01 Jan 2011 23:59:59 -0000",
),
(
datetime(2011, 1, 1, 23, 59, 59, tzinfo=pytz.timezone("CET")),
datetime(2011, 1, 1, 23, 59, 59, tzinfo=_CET_TIMEZONE),
"Sat, 01 Jan 2011 22:59:59 -0000",
),
],
Expand All @@ -566,7 +569,7 @@ def test_rfc822_value(self, value, expected):
"2011-01-01T23:59:59.001000+00:00",
),
(
datetime(2011, 1, 1, 23, 59, 59, tzinfo=pytz.timezone("CET")),
datetime(2011, 1, 1, 23, 59, 59, tzinfo=_CET_TIMEZONE),
"2011-01-01T23:59:59+01:00",
),
],
Expand Down Expand Up @@ -676,7 +679,7 @@ def test_max_exclusive(self):
(datetime(2011, 1, 1, 23, 59, 59, tzinfo=pytz.utc), "2011-01-01"),
(datetime(2011, 1, 1, 23, 59, 59, 1000, tzinfo=pytz.utc), "2011-01-01"),
(
datetime(2011, 1, 1, 23, 59, 59, tzinfo=pytz.timezone("CET")),
datetime(2011, 1, 1, 23, 59, 59, tzinfo=_CET_TIMEZONE),
"2011-01-01",
),
],
Expand Down