diff options
Diffstat (limited to 'django/test')
| -rw-r--r-- | django/test/testcases.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/django/test/testcases.py b/django/test/testcases.py index 14416807be..0d24bf0d40 100644 --- a/django/test/testcases.py +++ b/django/test/testcases.py @@ -595,6 +595,12 @@ class SimpleTestCase(unittest.TestCase): for i, context in enumerate(contexts): if form not in context: continue + if not context[form].is_bound: + form_repr = repr(context[form]) + self.fail( + f"{msg_prefix}The form {form_repr} is not bound, it will never " + f"have any errors." + ) found_form = True for err in errors: if field: @@ -680,6 +686,12 @@ class SimpleTestCase(unittest.TestCase): for i, context in enumerate(contexts): if formset not in context or not hasattr(context[formset], "forms"): continue + if not context[formset].is_bound: + formset_repr = repr(context[formset]) + self.fail( + f"{msg_prefix}The formset {formset_repr} is not bound, it will " + f"never have any errors." + ) found_formset = True for err in errors: if field is not None: |
