def test_markup(self):
     body = Body()
     with body:
         Div()
     self.assertEqual(
         dedent(
             """\
             <div>
             </div>
             """
         ),
         body.markup(width=80)
     )
 def test_markup_when_empty(self):
     html = HTML()
     with html:
         Head()
         Body()
     self.assertEqual(
         dedent(
             """\
             """
         ),
         html.markup(width=80)
     )
 def test_markup_when_first_child_is_script(self):
     html = HTML()
     with html:
         with Head():
             Title('Hello')
         with Body():
             Script(src='foo.js')
     self.assertEqual(
         dedent(
             """\
             <title>Hello</title>
             <body>
                 <script src=foo.js></script>
             """
         ),
         html.markup(width=80)
     )
 def test_markup(self):
     html = HTML()
     with html:
         with Head():
             Title('Hello')
         with Body():
             Div()
     self.assertEqual(
         dedent(
             """\
             <title>Hello</title>
             <div>
             </div>
             """
         ),
         html.markup(width=80)
     )
 def test_markup_when_first_child_is_a_comment(self):
     document = Document()
     with document:
         with HTML():
             Comment('foobar')
             with Head():
                 Title('Hello')
             Body()
     self.assertEqual(
         dedent(
             """\
             <html>
             <!-- foobar -->
             <title>Hello</title>
             """
         ),
         document.markup(width=80)
     )
 def test_markup_when_first_child_is_comment(self):
     html = HTML()
     with html:
         with Head():
             Title('Hello')
         with Body():
             Comment('foobar')
             Div()
     self.assertEqual(
         dedent(
             """\
             <title>Hello</title>
             <body>
                 <!-- foobar -->
                 <div>
                 </div>
             """
         ),
         html.markup(width=80)
     )
 def test_markup_for_empty_body(self):
     body = Body()
     self.assertEqual(
         '',
         body.markup(width=80)
     )