Fixed several flake8 errors, including one where a test wouldn't be run
This commit is contained in:
parent
268670a3a4
commit
b6b873d2ad
|
@ -360,7 +360,7 @@ def make_aware(value, timezone):
|
||||||
# Check that we won't overwrite the timezone of an aware datetime.
|
# Check that we won't overwrite the timezone of an aware datetime.
|
||||||
if is_aware(value):
|
if is_aware(value):
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"make_aware expects a naive datetime, got %s" % value)
|
"make_aware expects a naive datetime, got %s" % value)
|
||||||
# This may be wrong around DST changes!
|
# This may be wrong around DST changes!
|
||||||
return value.replace(tzinfo=timezone)
|
return value.replace(tzinfo=timezone)
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import unittest
|
||||||
from django.core.checks import Error, Warning as DjangoWarning
|
from django.core.checks import Error, Warning as DjangoWarning
|
||||||
from django.db import connection, models
|
from django.db import connection, models
|
||||||
from django.test.utils import override_settings
|
from django.test.utils import override_settings
|
||||||
from django.utils.timezone import make_aware, now
|
from django.utils.timezone import now
|
||||||
|
|
||||||
from .base import IsolatedModelsTestCase
|
from .base import IsolatedModelsTestCase
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,7 @@ class TimezoneTests(unittest.TestCase):
|
||||||
timezone.make_naive(datetime.datetime(2011, 9, 1, 13, 20, 30), EAT)
|
timezone.make_naive(datetime.datetime(2011, 9, 1, 13, 20, 30), EAT)
|
||||||
|
|
||||||
@unittest.skipIf(pytz is None, "this test requires pytz")
|
@unittest.skipIf(pytz is None, "this test requires pytz")
|
||||||
def test_make_aware(self):
|
def test_make_aware2(self):
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
timezone.make_aware(datetime.datetime(2011, 9, 1, 12, 20, 30), CET),
|
timezone.make_aware(datetime.datetime(2011, 9, 1, 12, 20, 30), CET),
|
||||||
CET.localize(datetime.datetime(2011, 9, 1, 12, 20, 30)))
|
CET.localize(datetime.datetime(2011, 9, 1, 12, 20, 30)))
|
||||||
|
|
Loading…
Reference in New Issue