diff options
author | Andrew Nester <andrew.nester.dev@gmail.com> | 2016-11-29 20:23:44 +0300 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2016-11-29 12:23:44 -0500 |
commit | ade52ef71f04e57e217585358cb289098260e3ec (patch) | |
tree | 2271911c2009dc7cb66f0339b11ad0877d2e1ea4 /tests/timezones | |
parent | fb3716b15679bc27926aebfd7c6ca9a8b3e986c3 (diff) | |
download | django-ade52ef71f04e57e217585358cb289098260e3ec.tar.gz |
Fixed #27544 -- Fixed QuerySet.update(dt=F('dt') + timedelta) crash on SQLite.
Diffstat (limited to 'tests/timezones')
-rw-r--r-- | tests/timezones/tests.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/timezones/tests.py b/tests/timezones/tests.py index d95877d227..c50d356074 100644 --- a/tests/timezones/tests.py +++ b/tests/timezones/tests.py @@ -14,7 +14,7 @@ from django.contrib.auth.models import User from django.core import serializers from django.core.exceptions import ImproperlyConfigured from django.db import connection, connections -from django.db.models import Max, Min +from django.db.models import F, Max, Min from django.http import HttpRequest from django.template import ( Context, RequestContext, Template, TemplateSyntaxError, context_processors, @@ -26,6 +26,7 @@ from django.test import ( from django.test.utils import requires_tz_support from django.urls import reverse from django.utils import six, timezone +from django.utils.timezone import timedelta from .forms import ( EventForm, EventLocalizedForm, EventLocalizedModelForm, EventModelForm, @@ -569,6 +570,13 @@ class NewDatabaseTests(TestCase): e = MaybeEvent.objects.create() self.assertIsNone(e.dt) + def test_update_with_timedelta(self): + initial_dt = timezone.now().replace(microsecond=0) + event = Event.objects.create(dt=initial_dt) + Event.objects.update(dt=F('dt') + timedelta(hours=2)) + event.refresh_from_db() + self.assertEqual(event.dt, initial_dt + timedelta(hours=2)) + @override_settings(TIME_ZONE='Africa/Nairobi', USE_TZ=True) class ForcedTimeZoneDatabaseTests(TransactionTestCase): |