1
0
mirror of https://github.com/django/django.git synced 2025-04-05 05:56:42 +00:00

Refs #32339 -- Fixed super() call in deprecated renderers.

Missing function call `()` leads to:

TypeError: descriptor '__init__' of 'super' object needs an argument

Regression in b209518089131c6b4afd18b1d9c320ba3521c5ab.
This commit is contained in:
Carlton Gibson 2023-05-17 16:11:43 +02:00 committed by GitHub
parent c52f4295f2
commit 4a5753fb0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View File

@ -81,7 +81,7 @@ class DjangoDivFormRenderer(DjangoTemplates):
"DjangoTemplates instead.",
RemovedInDjango60Warning,
)
super.__init__(*args, **kwargs)
super().__init__(*args, **kwargs)
# RemovedInDjango60Warning.
@ -97,7 +97,7 @@ class Jinja2DivFormRenderer(Jinja2):
"Jinja2 instead.",
RemovedInDjango60Warning,
)
super.__init__(*args, **kwargs)
super().__init__(*args, **kwargs)
class TemplatesSetting(BaseRenderer):

View File

@ -9,7 +9,7 @@ from django.forms.renderers import (
Jinja2DivFormRenderer,
TemplatesSetting,
)
from django.test import SimpleTestCase
from django.test import SimpleTestCase, ignore_warnings
from django.utils.deprecation import RemovedInDjango60Warning
try:
@ -74,3 +74,11 @@ class DeprecationTests(SimpleTestCase):
)
with self.assertRaisesMessage(RemovedInDjango60Warning, msg):
Jinja2DivFormRenderer()
@ignore_warnings(category=RemovedInDjango60Warning)
def test_deprecation_renderers_can_be_instantiated(self):
tests = [DjangoDivFormRenderer, Jinja2DivFormRenderer]
for cls in tests:
with self.subTest(renderer_class=cls):
renderer = cls()
self.assertIsInstance(renderer, cls)