mirror of
https://github.com/django/django.git
synced 2024-12-27 11:35:53 +00:00
[4.2.x] Refs #34118 -- Fixed CustomChoicesTests.test_uuid_unsupported on Python 3.11.4+.
5342f5e713
Follow up to38e63c9e61
. Backport of2eb1f37260
from main
This commit is contained in:
parent
b0d7753d07
commit
f6e0029fcd
@ -8,7 +8,6 @@ from django.template import Context, Template
|
|||||||
from django.test import SimpleTestCase
|
from django.test import SimpleTestCase
|
||||||
from django.utils.functional import Promise
|
from django.utils.functional import Promise
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.utils.version import PY312
|
|
||||||
|
|
||||||
|
|
||||||
class Suit(models.IntegerChoices):
|
class Suit(models.IntegerChoices):
|
||||||
@ -312,11 +311,7 @@ class CustomChoicesTests(SimpleTestCase):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def test_uuid_unsupported(self):
|
def test_uuid_unsupported(self):
|
||||||
if PY312:
|
with self.assertRaises(TypeError):
|
||||||
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):
|
class Identifier(uuid.UUID, models.Choices):
|
||||||
A = "972ce4eb-a95f-4a56-9339-68c208a76f18"
|
A = "972ce4eb-a95f-4a56-9339-68c208a76f18"
|
||||||
|
Loading…
Reference in New Issue
Block a user