summaryrefslogtreecommitdiff
path: root/tests/timezones/tests.py
diff options
context:
space:
mode:
authorabhiabhi94 <13880786+abhiabhi94@users.noreply.github.com>2021-07-01 18:49:09 +0530
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-07-06 10:44:06 +0200
commit6a5ef557f80a8eb6a758ebe99c8bb477ca47459e (patch)
tree80710446270fff12b5eac5f9ac3a67043d07830f /tests/timezones/tests.py
parentf35ab74752adb37138112657c1bc8b91f50e799b (diff)
Added test for errors when saving timezone-aware times if not supported.
Diffstat (limited to 'tests/timezones/tests.py')
-rw-r--r--tests/timezones/tests.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/timezones/tests.py b/tests/timezones/tests.py
index 861636ddf1..58c69bf769 100644
--- a/tests/timezones/tests.py
+++ b/tests/timezones/tests.py
@@ -37,7 +37,8 @@ from .forms import (
EventSplitForm,
)
from .models import (
- AllDayEvent, Event, MaybeEvent, Session, SessionEvent, Timestamp,
+ AllDayEvent, DailyEvent, Event, MaybeEvent, Session, SessionEvent,
+ Timestamp,
)
try:
@@ -270,6 +271,13 @@ class LegacyDatabaseTests(TestCase):
class NewDatabaseTests(TestCase):
naive_warning = 'DateTimeField Event.dt received a naive datetime'
+ @skipIfDBFeature('supports_timezones')
+ def test_aware_time_unsupported(self):
+ t = datetime.time(13, 20, 30, tzinfo=EAT)
+ msg = 'backend does not support timezone-aware times.'
+ with self.assertRaisesMessage(ValueError, msg):
+ DailyEvent.objects.create(time=t)
+
@requires_tz_support
def test_naive_datetime(self):
dt = datetime.datetime(2011, 9, 1, 13, 20, 30)