diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2012-01-02 20:45:09 +0000 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2012-01-02 20:45:09 +0000 |
| commit | fc9e0606d5333fc1906c85cc7ac3b2020e0b1baa (patch) | |
| tree | 866552d0ceb7f49300801d3ee0d396e66e8fd2ae /tests | |
| parent | b895b297a610c30c2eb80c0433d8e5736a509d53 (diff) | |
Fixed a stupid bug in the implementation of timezone.make_aware.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17332 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/modeltests/timezones/tests.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/modeltests/timezones/tests.py b/tests/modeltests/timezones/tests.py index cbfa0d8e74..b46aa0ed8c 100644 --- a/tests/modeltests/timezones/tests.py +++ b/tests/modeltests/timezones/tests.py @@ -953,3 +953,30 @@ class AdminTests(BaseDateTimeTests): self.assertContains(response, t.created.astimezone(ICT).isoformat()) AdminTests = override_settings(DATETIME_FORMAT='c', USE_L10N=False, USE_TZ=True)(AdminTests) + + +class UtilitiesTests(BaseDateTimeTests): + + def test_make_aware(self): + self.assertEqual( + timezone.make_aware(datetime.datetime(2011, 9, 1, 13, 20, 30), EAT), + datetime.datetime(2011, 9, 1, 13, 20, 30, tzinfo=EAT) + ) + self.assertEqual( + timezone.make_aware(datetime.datetime(2011, 9, 1, 10, 20, 30), UTC), + datetime.datetime(2011, 9, 1, 10, 20, 30, tzinfo=UTC) + ) + + def test_make_naive(self): + self.assertEqual( + timezone.make_naive(datetime.datetime(2011, 9, 1, 13, 20, 30, tzinfo=EAT), EAT), + datetime.datetime(2011, 9, 1, 13, 20, 30) + ) + self.assertEqual( + timezone.make_naive(datetime.datetime(2011, 9, 1, 13, 20, 30, tzinfo=EAT), UTC), + datetime.datetime(2011, 9, 1, 10, 20, 30) + ) + self.assertEqual( + timezone.make_naive(datetime.datetime(2011, 9, 1, 10, 20, 30, tzinfo=UTC), UTC), + datetime.datetime(2011, 9, 1, 10, 20, 30) + ) |
