mirror of https://github.com/django/django.git
Refs #34118 -- Fixed CustomChoicesTests.test_uuid_unsupported on Python 3.12+.
2a4d8c0a9e
This commit is contained in:
parent
fdf0a367bd
commit
38e63c9e61
|
@ -16,6 +16,7 @@ PY38 = sys.version_info >= (3, 8)
|
||||||
PY39 = sys.version_info >= (3, 9)
|
PY39 = sys.version_info >= (3, 9)
|
||||||
PY310 = sys.version_info >= (3, 10)
|
PY310 = sys.version_info >= (3, 10)
|
||||||
PY311 = sys.version_info >= (3, 11)
|
PY311 = sys.version_info >= (3, 11)
|
||||||
|
PY312 = sys.version_info >= (3, 12)
|
||||||
|
|
||||||
|
|
||||||
def get_version(version=None):
|
def get_version(version=None):
|
||||||
|
|
|
@ -8,6 +8,7 @@ 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):
|
||||||
|
@ -311,6 +312,9 @@ class CustomChoicesTests(SimpleTestCase):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def test_uuid_unsupported(self):
|
def test_uuid_unsupported(self):
|
||||||
|
if PY312:
|
||||||
|
msg = "_value_ not set in __new__, unable to create it"
|
||||||
|
else:
|
||||||
msg = "UUID objects are immutable"
|
msg = "UUID objects are immutable"
|
||||||
with self.assertRaisesMessage(TypeError, msg):
|
with self.assertRaisesMessage(TypeError, msg):
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue