summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorBaptiste Mispelon <bmispelon@gmail.com>2021-12-08 14:46:22 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-12-08 21:13:00 +0100
commit15031852c5ef6b3713bb9766d918460ea46e254e (patch)
treeed57a5793d8235f377be0794e28c23df6f1d2ae3 /django
parentb7f2afa8de3cef4a4d5d5e413e502b09ea01163d (diff)
[4.0.x] Fixed #33346 -- Fixed SimpleTestCase.assertFormsetError() crash on a formset named "form".
Thanks OutOfFocus4 for the report. Regression in 456466d932830b096d39806e291fe23ec5ed38d5. Backport of cb383753c0e0eb52306e1024d32a782549c27e61 from main.
Diffstat (limited to 'django')
-rw-r--r--django/test/testcases.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/django/test/testcases.py b/django/test/testcases.py
index b56e8f5edf..28cf45e8ba 100644
--- a/django/test/testcases.py
+++ b/django/test/testcases.py
@@ -557,7 +557,7 @@ class SimpleTestCase(unittest.TestCase):
# Search all contexts for the error.
found_formset = False
for i, context in enumerate(contexts):
- if formset not in context:
+ if formset not in context or not hasattr(context[formset], 'forms'):
continue
found_formset = True
for err in errors: