summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2023-04-05 13:59:10 +0200
committerGitHub <noreply@github.com>2023-04-05 13:59:10 +0200
commit38e63c9e61152682f3ff982c85a73793ab6d3267 (patch)
tree65720cdb5044638489b44a7e25af5c06886eb994
parentfdf0a367bdd72c70f91fb3aed77dabbe9dcef69f (diff)
downloaddjango-38e63c9e61152682f3ff982c85a73793ab6d3267.tar.gz
Refs #34118 -- Fixed CustomChoicesTests.test_uuid_unsupported on Python 3.12+.
https://github.com/python/cpython/commit/2a4d8c0a9e88f45047da640ce5a92b304d2d39b1
-rw-r--r--django/utils/version.py1
-rw-r--r--tests/model_enums/tests.py6
2 files changed, 6 insertions, 1 deletions
diff --git a/django/utils/version.py b/django/utils/version.py
index 5b6a435b51..1e9c720299 100644
--- a/django/utils/version.py
+++ b/django/utils/version.py
@@ -16,6 +16,7 @@ PY38 = sys.version_info >= (3, 8)
PY39 = sys.version_info >= (3, 9)
PY310 = sys.version_info >= (3, 10)
PY311 = sys.version_info >= (3, 11)
+PY312 = sys.version_info >= (3, 12)
def get_version(version=None):
diff --git a/tests/model_enums/tests.py b/tests/model_enums/tests.py
index 347c464a8c..1276341108 100644
--- a/tests/model_enums/tests.py
+++ b/tests/model_enums/tests.py
@@ -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):