File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -1343,15 +1343,22 @@ def setup_class(cls):
1343
1343
cls .field = serializers .DateTimeField ()
1344
1344
cls .kolkata = pytz .timezone ('Asia/Kolkata' )
1345
1345
1346
+ @staticmethod
1347
+ def is_utc (tz ):
1348
+ """Django 2.1 uses datetime.timezone.utc
1349
+
1350
+ Ref: https://github.com/django/django/pull/9484#issuecomment-399169042"""
1351
+ return tz .utcoffset (None ).total_seconds () == 0.0
1352
+
1346
1353
def test_default_timezone (self ):
1347
- assert self .field .default_timezone () == utc
1354
+ assert self .is_utc ( self . field .default_timezone ())
1348
1355
1349
1356
def test_current_timezone (self ):
1350
- assert self .field .default_timezone () == utc
1357
+ assert self .is_utc ( self . field .default_timezone ())
1351
1358
activate (self .kolkata )
1352
1359
assert self .field .default_timezone () == self .kolkata
1353
1360
deactivate ()
1354
- assert self .field .default_timezone () == utc
1361
+ assert self .is_utc ( self . field .default_timezone ())
1355
1362
1356
1363
1357
1364
@pytest .mark .skipif (pytz is None , reason = 'pytz not installed' )
You can’t perform that action at this time.
0 commit comments