summaryrefslogtreecommitdiff
path: root/tests/admin_utils
diff options
context:
space:
mode:
authorAlexander Lazarević <laza@e11bits.com>2024-01-11 11:44:01 +0700
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2024-01-11 12:47:06 +0100
commit4787972c941b0d090cf083e84a98c1791bb2ae4b (patch)
treec5a4a3526d50d70ec8e4f36a4cbc064e150421e7 /tests/admin_utils
parent40b5b1596f7505416bd30d5d7582b5a9004ea7d5 (diff)
Refs #28404 -- Made displaying property values in admin respect non-None empty values.
Diffstat (limited to 'tests/admin_utils')
-rw-r--r--tests/admin_utils/tests.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/admin_utils/tests.py b/tests/admin_utils/tests.py
index 393770bd2d..067b47198d 100644
--- a/tests/admin_utils/tests.py
+++ b/tests/admin_utils/tests.py
@@ -17,6 +17,7 @@ from django.contrib.admin.utils import (
lookup_field,
quote,
)
+from django.core.validators import EMPTY_VALUES
from django.db import DEFAULT_DB_ALIAS, models
from django.test import SimpleTestCase, TestCase, override_settings
from django.utils.formats import localize
@@ -249,6 +250,12 @@ class UtilsTests(SimpleTestCase):
self.assertEqual(display_for_value(True, ""), "True")
self.assertEqual(display_for_value(False, ""), "False")
+ def test_list_display_for_value_empty(self):
+ for value in EMPTY_VALUES:
+ with self.subTest(empty_value=value):
+ display_value = display_for_value(value, self.empty_value)
+ self.assertEqual(display_value, self.empty_value)
+
def test_label_for_field(self):
"""
Tests for label_for_field