mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Refs #23919 -- Stopped inheriting from object to define new style classes.
This commit is contained in:
parent
a556396339
commit
cecc079168
293 changed files with 512 additions and 514 deletions
|
@ -167,7 +167,7 @@ class TestUtilsHtml(SimpleTestCase):
|
|||
|
||||
def test_html_safe(self):
|
||||
@html.html_safe
|
||||
class HtmlClass(object):
|
||||
class HtmlClass:
|
||||
def __str__(self):
|
||||
return "<h1>I'm a html class!</h1>"
|
||||
|
||||
|
@ -177,7 +177,7 @@ class TestUtilsHtml(SimpleTestCase):
|
|||
self.assertEqual(force_text(html_obj), html_obj.__html__())
|
||||
|
||||
def test_html_safe_subclass(self):
|
||||
class BaseClass(object):
|
||||
class BaseClass:
|
||||
def __html__(self):
|
||||
# defines __html__ on its own
|
||||
return 'some html content'
|
||||
|
@ -198,7 +198,7 @@ class TestUtilsHtml(SimpleTestCase):
|
|||
msg = "can't apply @html_safe to HtmlClass because it defines __html__()."
|
||||
with self.assertRaisesMessage(ValueError, msg):
|
||||
@html.html_safe
|
||||
class HtmlClass(object):
|
||||
class HtmlClass:
|
||||
def __html__(self):
|
||||
return "<h1>I'm a html class!</h1>"
|
||||
|
||||
|
@ -206,5 +206,5 @@ class TestUtilsHtml(SimpleTestCase):
|
|||
msg = "can't apply @html_safe to HtmlClass because it doesn't define __str__()."
|
||||
with self.assertRaisesMessage(ValueError, msg):
|
||||
@html.html_safe
|
||||
class HtmlClass(object):
|
||||
class HtmlClass:
|
||||
pass
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue