summaryrefslogtreecommitdiff
path: root/tests/model_forms/test_modelchoicefield.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/model_forms/test_modelchoicefield.py')
-rw-r--r--tests/model_forms/test_modelchoicefield.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/tests/model_forms/test_modelchoicefield.py b/tests/model_forms/test_modelchoicefield.py
index 7f66b5b078..40c625da7c 100644
--- a/tests/model_forms/test_modelchoicefield.py
+++ b/tests/model_forms/test_modelchoicefield.py
@@ -2,6 +2,7 @@ import datetime
from django import forms
from django.core.exceptions import ValidationError
+from django.db.models.utils import get_blank_choice_label
from django.forms.models import ModelChoiceIterator, ModelChoiceIteratorValue
from django.forms.widgets import CheckboxSelectMultiple
from django.template import Context, Template
@@ -24,7 +25,7 @@ class ModelChoiceFieldTests(TestCase):
self.assertEqual(
list(f.choices),
[
- ("", "---------"),
+ ("", get_blank_choice_label()),
(self.c1.pk, "Entertainment"),
(self.c2.pk, "A test"),
(self.c3.pk, "Third"),
@@ -102,7 +103,7 @@ class ModelChoiceFieldTests(TestCase):
self.assertEqual(
list(f.choices),
[
- ("", "---------"),
+ ("", get_blank_choice_label()),
(self.c1.pk, "Entertainment"),
(self.c2.pk, "A test"),
],
@@ -118,7 +119,7 @@ class ModelChoiceFieldTests(TestCase):
self.assertEqual(
list(gen_two),
[
- ("", "---------"),
+ ("", get_blank_choice_label()),
(self.c1.pk, "Entertainment"),
(self.c2.pk, "A test"),
],
@@ -130,7 +131,7 @@ class ModelChoiceFieldTests(TestCase):
self.assertEqual(
list(f.choices),
[
- ("", "---------"),
+ ("", get_blank_choice_label()),
(self.c1.pk, "category Entertainment"),
(self.c2.pk, "category A test"),
(self.c3.pk, "category Third"),
@@ -143,7 +144,7 @@ class ModelChoiceFieldTests(TestCase):
self.assertEqual(
list(f.choices),
[
- ("", "---------"),
+ ("", get_blank_choice_label()),
(self.c1.pk, "Entertainment"),
(self.c2.pk, "A test"),
(self.c3.pk, "Third"),
@@ -154,7 +155,7 @@ class ModelChoiceFieldTests(TestCase):
self.assertEqual(
list(f.choices),
[
- ("", "---------"),
+ ("", get_blank_choice_label()),
(self.c1.pk, "Entertainment"),
(self.c2.pk, "A test"),
(self.c3.pk, "Third"),
@@ -174,6 +175,7 @@ class ModelChoiceFieldTests(TestCase):
self.assertIs(bool(f.choices), True)
def test_choices_radio_blank(self):
+ blank_choice = [("", get_blank_choice_label())]
choices = [
(self.c1.pk, "Entertainment"),
(self.c2.pk, "A test"),
@@ -190,7 +192,7 @@ class ModelChoiceFieldTests(TestCase):
)
self.assertEqual(
list(f.choices),
- [("", "---------")] + choices if blank else choices,
+ (blank_choice + choices if blank else choices),
)
def test_deepcopies_widget(self):
@@ -424,7 +426,7 @@ class ModelChoiceFieldTests(TestCase):
self.assertCountEqual(
list(f.choices),
[
- ("", "---------"),
+ ("", get_blank_choice_label()),
(self.c1.pk, "Entertainment"),
(self.c2.pk, "A test"),
(self.c3.pk, "Third"),