summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2020-01-11 19:47:36 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-01-11 19:49:38 +0100
commit92866682c6b4bd4f2ec67d6c6596e8c85585a4fd (patch)
tree3d2d156dd0c458e606f9ddc04c11c3f707b9b757 /tests
parent16297e7d5e3a6b0287d114e95d1d544995618c93 (diff)
[3.0.x] Fixed #31155 -- Fixed a system check for the longest choice when a named group contains only non-string values.
Regression in b6251956b69512bf230322bd7a49b629ca8455c6. Thanks Murat Guchetl for the report. Backport of 6f7998adc784032f4b8918ca2eea27537ea4cbbe from master
Diffstat (limited to 'tests')
-rw-r--r--tests/invalid_models_tests/test_ordinary_fields.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/invalid_models_tests/test_ordinary_fields.py b/tests/invalid_models_tests/test_ordinary_fields.py
index 2ef0907a6a..6f91a74e92 100644
--- a/tests/invalid_models_tests/test_ordinary_fields.py
+++ b/tests/invalid_models_tests/test_ordinary_fields.py
@@ -1,4 +1,5 @@
import unittest
+import uuid
from django.core.checks import Error, Warning as DjangoWarning
from django.db import connection, models
@@ -768,3 +769,20 @@ class TextFieldTests(TestCase):
id='fields.W162',
)
])
+
+
+@isolate_apps('invalid_models_tests')
+class UUIDFieldTests(TestCase):
+ def test_choices_named_group(self):
+ class Model(models.Model):
+ field = models.UUIDField(
+ choices=[
+ ['knights', [
+ [uuid.UUID('5c859437-d061-4847-b3f7-e6b78852f8c8'), 'Lancelot'],
+ [uuid.UUID('c7853ec1-2ea3-4359-b02d-b54e8f1bcee2'), 'Galahad'],
+ ]],
+ [uuid.UUID('25d405be-4895-4d50-9b2e-d6695359ce47'), 'Other'],
+ ],
+ )
+
+ self.assertEqual(Model._meta.get_field('field').check(), [])