Skip to content

Commit 6835cdb

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent ab61a78 commit 6835cdb

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

morepath_wiki/html.py

+30-30
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ def __exit__(self, exc_type, exc_value, exc_tb):
346346
self._stack.pop()
347347

348348
def __repr__(self):
349-
return "<HTML {} 0x{:x}>".format(self._name, id(self))
349+
return f"<HTML {self._name} 0x{id(self):x}>"
350350

351351
def _stringify(self, str_type):
352352
# turn me and my content into text
@@ -424,19 +424,19 @@ def _stringify(self, str_type):
424424
class TestCase(unittest.TestCase):
425425
def test_empty_tag(self):
426426
"generation of an empty HTML tag"
427-
self.assertEquals(str(HTML().br), "<br>")
427+
self.assertEqual(str(HTML().br), "<br>")
428428

429429
def test_empty_tag_xml(self):
430430
"generation of an empty XHTML tag"
431-
self.assertEquals(str(XHTML().br), "<br />")
431+
self.assertEqual(str(XHTML().br), "<br />")
432432

433433
def test_tag_add(self):
434434
"test top-level tag creation"
435-
self.assertEquals(str(HTML("html", "text")), "<html>\ntext\n</html>")
435+
self.assertEqual(str(HTML("html", "text")), "<html>\ntext\n</html>")
436436

437437
def test_tag_add_no_newline(self):
438438
"test top-level tag creation"
439-
self.assertEquals(
439+
self.assertEqual(
440440
str(HTML("html", "text", newlines=False)), "<html>text</html>"
441441
)
442442

@@ -445,7 +445,7 @@ def test_iadd_tag(self):
445445
h = XML("xml")
446446
h += XML("some-tag", "spam", newlines=False)
447447
h += XML("text", "spam", newlines=False)
448-
self.assertEquals(
448+
self.assertEqual(
449449
str(h),
450450
"<xml>\n<some-tag>spam</some-tag>\n<text>spam</text>\n</xml>",
451451
)
@@ -455,79 +455,79 @@ def test_iadd_text(self):
455455
h = HTML("html", newlines=False)
456456
h += "text"
457457
h += "text"
458-
self.assertEquals(str(h), "<html>texttext</html>")
458+
self.assertEqual(str(h), "<html>texttext</html>")
459459

460460
def test_xhtml_match_tag(self):
461461
"check forced generation of matching tag when empty"
462-
self.assertEquals(str(XHTML().p), "<p></p>")
462+
self.assertEqual(str(XHTML().p), "<p></p>")
463463

464464
if sys.version_info[0] == 2:
465465

466466
def test_empty_tag_unicode(self):
467467
"generation of an empty HTML tag"
468-
self.assertEquals(unicode(HTML().br), unicode("<br>"))
468+
self.assertEqual(unicode(HTML().br), unicode("<br>"))
469469

470470
def test_empty_tag_xml_unicode(self):
471471
"generation of an empty XHTML tag"
472-
self.assertEquals(unicode(XHTML().br), unicode("<br />"))
472+
self.assertEqual(unicode(XHTML().br), unicode("<br />"))
473473

474474
def test_xhtml_match_tag_unicode(self):
475475
"check forced generation of matching tag when empty"
476-
self.assertEquals(unicode(XHTML().p), unicode("<p></p>"))
476+
self.assertEqual(unicode(XHTML().p), unicode("<p></p>"))
477477

478478
def test_just_tag(self):
479479
"generate HTML for just one tag"
480-
self.assertEquals(str(HTML().br), "<br>")
480+
self.assertEqual(str(HTML().br), "<br>")
481481

482482
def test_just_tag_xhtml(self):
483483
"generate XHTML for just one tag"
484-
self.assertEquals(str(XHTML().br), "<br />")
484+
self.assertEqual(str(XHTML().br), "<br />")
485485

486486
def test_xml(self):
487487
"generate XML"
488-
self.assertEquals(str(XML().br), "<br />")
489-
self.assertEquals(str(XML().p), "<p />")
490-
self.assertEquals(str(XML().br("text")), "<br>text</br>")
488+
self.assertEqual(str(XML().br), "<br />")
489+
self.assertEqual(str(XML().p), "<p />")
490+
self.assertEqual(str(XML().br("text")), "<br>text</br>")
491491

492492
def test_para_tag(self):
493493
"generation of a tag with contents"
494494
h = HTML()
495495
h.p("hello")
496-
self.assertEquals(str(h), "<p>hello</p>")
496+
self.assertEqual(str(h), "<p>hello</p>")
497497

498498
def test_escape(self):
499499
"escaping of special HTML characters in text"
500500
h = HTML()
501501
h.text("<>&")
502-
self.assertEquals(str(h), "&lt;&gt;&amp;")
502+
self.assertEqual(str(h), "&lt;&gt;&amp;")
503503

504504
def test_no_escape(self):
505505
"no escaping of special HTML characters in text"
506506
h = HTML()
507507
h.text("<>&", False)
508-
self.assertEquals(str(h), "<>&")
508+
self.assertEqual(str(h), "<>&")
509509

510510
def test_escape_attr(self):
511511
"escaping of special HTML characters in attributes"
512512
h = HTML()
513513
h.br(id='<>&"')
514-
self.assertEquals(str(h), '<br id="&lt;&gt;&amp;&quot;">')
514+
self.assertEqual(str(h), '<br id="&lt;&gt;&amp;&quot;">')
515515

516516
def test_subtag_context(self):
517517
'generation of sub-tags using "with" context'
518518
h = HTML()
519519
with h.ol:
520520
h.li("foo")
521521
h.li("bar")
522-
self.assertEquals(str(h), "<ol>\n<li>foo</li>\n<li>bar</li>\n</ol>")
522+
self.assertEqual(str(h), "<ol>\n<li>foo</li>\n<li>bar</li>\n</ol>")
523523

524524
def test_subtag_direct(self):
525525
"generation of sub-tags directly on the parent tag"
526526
h = HTML()
527527
l = h.ol
528528
l.li("foo")
529529
l.li.b("bar")
530-
self.assertEquals(
530+
self.assertEqual(
531531
str(h), "<ol>\n<li>foo</li>\n<li><b>bar</b></li>\n</ol>"
532532
)
533533

@@ -537,7 +537,7 @@ def test_subtag_direct_context(self):
537537
with h.ol as l:
538538
l.li("foo")
539539
l.li.b("bar")
540-
self.assertEquals(
540+
self.assertEqual(
541541
str(h), "<ol>\n<li>foo</li>\n<li><b>bar</b></li>\n</ol>"
542542
)
543543

@@ -547,35 +547,35 @@ def test_subtag_no_newlines(self):
547547
l = h.ol(newlines=False)
548548
l.li("foo")
549549
l.li("bar")
550-
self.assertEquals(str(h), "<ol><li>foo</li><li>bar</li></ol>")
550+
self.assertEqual(str(h), "<ol><li>foo</li><li>bar</li></ol>")
551551

552552
def test_add_text(self):
553553
"add text to a tag"
554554
h = HTML()
555555
p = h.p("hello, world!\n")
556556
p.text("more text")
557-
self.assertEquals(str(h), "<p>hello, world!\nmore text</p>")
557+
self.assertEqual(str(h), "<p>hello, world!\nmore text</p>")
558558

559559
def test_add_text_newlines(self):
560560
"add text to a tag with newlines for prettiness"
561561
h = HTML()
562562
p = h.p("hello, world!", newlines=True)
563563
p.text("more text")
564-
self.assertEquals(str(h), "<p>\nhello, world!\nmore text\n</p>")
564+
self.assertEqual(str(h), "<p>\nhello, world!\nmore text\n</p>")
565565

566566
def test_doc_newlines(self):
567567
"default document adding newlines between tags"
568568
h = HTML()
569569
h.br
570570
h.br
571-
self.assertEquals(str(h), "<br>\n<br>")
571+
self.assertEqual(str(h), "<br>\n<br>")
572572

573573
def test_doc_no_newlines(self):
574574
"prevent document adding newlines between tags"
575575
h = HTML(newlines=False)
576576
h.br
577577
h.br
578-
self.assertEquals(str(h), "<br><br>")
578+
self.assertEqual(str(h), "<br><br>")
579579

580580
def test_unicode(self):
581581
"make sure unicode input works and results in unicode output"
@@ -588,7 +588,7 @@ def test_unicode(self):
588588
unicode = str
589589
TEST = "euro €"
590590
h.p(TEST)
591-
self.assertEquals(unicode(h), "<p>%s</p>" % TEST)
591+
self.assertEqual(unicode(h), "<p>%s</p>" % TEST)
592592

593593
def test_table(self):
594594
'multiple "with" context blocks'
@@ -598,7 +598,7 @@ def test_table(self):
598598
with h.tr:
599599
h.td("column 1")
600600
h.td("column 2")
601-
self.assertEquals(
601+
self.assertEqual(
602602
str(h),
603603
"""<table border="1">
604604
<tr><td>column 1</td><td>column 2</td></tr>

0 commit comments

Comments
 (0)