1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Renamed ChoicesMeta to ChoicesType.

This also uses enum.EnumType for Python 3.11+ as Python 3.11 renamed
EnumMeta to EnumType. While the former is still available as an alias
of the latter for now, let's prefer the canonical name for this.

Check out https://docs.python.org/3/library/enum.html#enum.EnumType
This commit is contained in:
Nick Pope
2023-08-23 10:04:37 +01:00
committed by Mariusz Felisiak
parent 8aa8346466
commit e15174983a
5 changed files with 39 additions and 5 deletions

View File

@@ -6,6 +6,7 @@ import uuid
from django.db import models
from django.template import Context, Template
from django.test import SimpleTestCase
from django.utils.deprecation import RemovedInDjango60Warning
from django.utils.functional import Promise
from django.utils.translation import gettext_lazy as _
@@ -315,3 +316,12 @@ class CustomChoicesTests(SimpleTestCase):
class Identifier(uuid.UUID, models.Choices):
A = "972ce4eb-a95f-4a56-9339-68c208a76f18"
class ChoicesMetaDeprecationTests(SimpleTestCase):
def test_deprecation_warning(self):
from django.db.models import enums
msg = "ChoicesMeta is deprecated in favor of ChoicesType."
with self.assertWarnsMessage(RemovedInDjango60Warning, msg):
enums.ChoicesMeta