def test_nesting(): assert matches(H.div(H.div(H.b("inner"))), "<div><div><b>inner</b></div></div>") assert matches(H.div(H.b("hello"), H.i("there")), "<div><b>hello</b><i>there</i></div>") assert matches( H.div([[[H.b("hello"), [H.i("there")]]]]), "<div><b>hello</b><i>there</i></div>", )
def error(self, message): print(H.i(message, style="color:red"))
def test_inline(): assert matches(H.inline("thing"), "thing") assert matches(H.inline("<b>hello</b>"), "<b>hello</b>") assert matches(H.inline(H.b("hello"), H.i("there")), "<b>hello</b><i>there</i>")
def test_raw(): assert matches(H.raw("thing"), "thing") assert matches(H.raw("<b>hello</b>"), "<b>hello</b>") assert matches(H.raw(H.b("hello"), H.i("there")), "<b>hello</b><i>there</i>") assert matches(H.raw(H.b("<inner>")), "<b><inner></b>")
def test_misc(): assert matches(H.whimsy("cal"), "<whimsy>cal</whimsy>") assert H.div(H.b("hello")) == H.div(H.b("hello")) assert H.div(H.b("hello")) != H.div(H.i("hello")) assert isinstance(hash(H.div(H.div("yay!"))), int) assert repr(H.div("soupe")) == str(H.div("soupe"))