mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	[4.0.x] Fixed #33279 -- Fixed handling time zones with "-" sign in names.
Thanks yakimka for the report. Regression infde9b7d35e. Backport of661316b066from main.
This commit is contained in:
		
				
					committed by
					
						 Mariusz Felisiak
						Mariusz Felisiak
					
				
			
			
				
	
			
			
			
						parent
						
							45de30dc69
						
					
				
				
					commit
					d54aa49a7d
				
			| @@ -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