diff options
| author | Marcelo Galigniana <marcelogaligniana@gmail.com> | 2023-02-13 21:19:21 -0300 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-02-15 07:36:05 +0100 |
| commit | 5b23d6666e7166a797f423c7b2c74aa85feb3d63 (patch) | |
| tree | 10bb5ced940c60cd0531e93852941e5106181534 | |
| parent | e13954d2cfe8fba2045076b20a863aa7614937e6 (diff) | |
Completed test coverage for django.forms.utils.
| -rw-r--r-- | tests/forms_tests/tests/test_utils.py | 19 |
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(""), "") |
