mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed #33279 -- Fixed handling time zones with "-" sign in names.
Thanks yakimka for the report.
Regression in fde9b7d35e.
This commit is contained in:
committed by
Mariusz Felisiak
parent
78163d1ac4
commit
661316b066
@@ -3,7 +3,7 @@ from decimal import Decimal, Rounded
|
||||
|
||||
from django.db import NotSupportedError, connection
|
||||
from django.db.backends.utils import (
|
||||
format_number, split_identifier, truncate_name,
|
||||
format_number, split_identifier, split_tzname_delta, truncate_name,
|
||||
)
|
||||
from django.test import (
|
||||
SimpleTestCase, TransactionTestCase, skipIfDBFeature, skipUnlessDBFeature,
|
||||
@@ -57,6 +57,23 @@ class TestUtils(SimpleTestCase):
|
||||
with self.assertRaises(Rounded):
|
||||
equal('1234567890.1234', 5, None, '1234600000')
|
||||
|
||||
def test_split_tzname_delta(self):
|
||||
tests = [
|
||||
('Asia/Ust+Nera', ('Asia/Ust+Nera', None, None)),
|
||||
('Asia/Ust-Nera', ('Asia/Ust-Nera', None, None)),
|
||||
('Asia/Ust+Nera-02:00', ('Asia/Ust+Nera', '-', '02:00')),
|
||||
('Asia/Ust-Nera+05:00', ('Asia/Ust-Nera', '+', '05:00')),
|
||||
('America/Coral_Harbour-01:00', ('America/Coral_Harbour', '-', '01:00')),
|
||||
('America/Coral_Harbour+02:30', ('America/Coral_Harbour', '+', '02:30')),
|
||||
('UTC+15:00', ('UTC', '+', '15:00')),
|
||||
('UTC-04:43', ('UTC', '-', '04:43')),
|
||||
('UTC', ('UTC', None, None)),
|
||||
('UTC+1', ('UTC+1', None, None)),
|
||||
]
|
||||
for tzname, expected in tests:
|
||||
with self.subTest(tzname=tzname):
|
||||
self.assertEqual(split_tzname_delta(tzname), expected)
|
||||
|
||||
|
||||
class CursorWrapperTests(TransactionTestCase):
|
||||
available_apps = []
|
||||
|
||||
Reference in New Issue
Block a user