summaryrefslogtreecommitdiff
path: root/tests/forms_tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests/forms_tests')
-rw-r--r--tests/forms_tests/tests/test_utils.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/forms_tests/tests/test_utils.py b/tests/forms_tests/tests/test_utils.py
index a921a924b6..2e5672f93c 100644
--- a/tests/forms_tests/tests/test_utils.py
+++ b/tests/forms_tests/tests/test_utils.py
@@ -2,7 +2,13 @@ import copy
import json
from django.core.exceptions import ValidationError
-from django.forms.utils import ErrorDict, ErrorList, flatatt
+from django.forms.utils import (
+ ErrorDict,
+ ErrorList,
+ RenderableMixin,
+ flatatt,
+ pretty_name,
+)
from django.test import SimpleTestCase
from django.utils.safestring import mark_safe
from django.utils.translation import gettext_lazy
@@ -245,3 +251,14 @@ class FormsUtilsTestCase(SimpleTestCase):
],
},
)
+
+ def test_get_context_must_be_implemented(self):
+ mixin = RenderableMixin()
+ msg = "Subclasses of RenderableMixin must provide a get_context() method."
+ with self.assertRaisesMessage(NotImplementedError, msg):
+ mixin.get_context()
+
+ def test_pretty_name(self):
+ self.assertEqual(pretty_name("john_doe"), "John doe")
+ self.assertEqual(pretty_name(None), "")
+ self.assertEqual(pretty_name(""), "")