1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +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:
Can Sarigol
2021-11-11 09:57:50 +01:00
committed by Mariusz Felisiak
parent 78163d1ac4
commit 661316b066
7 changed files with 72 additions and 24 deletions

View File

@@ -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 = []