mirror of
https://github.com/django/django.git
synced 2025-10-27 23:56:08 +00:00
[4.2.x] Refs #34118 -- Fixed CustomChoicesTests.test_uuid_unsupported on Python 3.12+.
2a4d8c0a9eBackport of38e63c9e61from main
This commit is contained in:
@@ -8,6 +8,7 @@ from django.template import Context, Template
|
||||
from django.test import SimpleTestCase
|
||||
from django.utils.functional import Promise
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.utils.version import PY312
|
||||
|
||||
|
||||
class Suit(models.IntegerChoices):
|
||||
@@ -311,7 +312,10 @@ class CustomChoicesTests(SimpleTestCase):
|
||||
pass
|
||||
|
||||
def test_uuid_unsupported(self):
|
||||
msg = "UUID objects are immutable"
|
||||
if PY312:
|
||||
msg = "_value_ not set in __new__, unable to create it"
|
||||
else:
|
||||
msg = "UUID objects are immutable"
|
||||
with self.assertRaisesMessage(TypeError, msg):
|
||||
|
||||
class Identifier(uuid.UUID, models.Choices):
|
||||
|
||||
Reference in New Issue
Block a user