1
0
mirror of https://github.com/django/django.git synced 2025-01-03 06:55:47 +00:00

Completed test coverage for django.forms.utils.

This commit is contained in:
Marcelo Galigniana 2023-02-13 21:19:21 -03:00 committed by Mariusz Felisiak
parent e13954d2cf
commit 5b23d6666e

View File

@ -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(""), "")