def test_markup_for_long_line(self):
        title = Title('This is a very very very extremely long title.')
        self.assertEqual(
            dedent("""\
                <title>
                    This is a very very very extremely
                    long title.
                </title>
                """

                   # 0123456789012345678901234567890123456789
                   ),
            title.markup(width=40))
 def test_markup(self):
     head = Head()
     with head:
         Title('Hello')
     self.assertEqual(
         dedent(
             """\
             <title>Hello</title>
             """
         ),
         head.markup(width=80)
     )
 def test_markup_when_first_child_is_a_comment(self):
     head = Head()
     with head:
         Comment('foobar')
         Title('Hello')
     self.assertEqual(
         dedent(
             """\
             <head>
                 <!-- foobar -->
                 <title>Hello</title>
             """
         ),
         head.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_followed_by_comment(self):
     html = HTML()
     with html:
         with Head():
             Title('Hello')
         Comment('foobar')
     self.assertEqual(
         dedent(
             """\
             <head>
                 <title>Hello</title>
             </head>
             <!-- foobar -->
             """
         ),
         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_short_line(self):
     title = Title('This is a short title.')
     self.assertEqual('<title>This is a short title.</title>\n',
                      title.markup(width=40))