Пример #1
0
 def test_document_empty(self):
     document = create_empty_doc()
     expected = "\n".join([
         '<html>',
         '<head>',
         '<meta charset="utf-8">',
         '<title></title>',
         '<link rel="stylesheet" href="css/styles.css">',
         '</head>',
         '<body><div id="text_area"></div></body>',
         '</html>\n',
     ])
     assert str(document) == expected
Пример #2
0
 def test_document_add_section_id(self):
     document = create_empty_doc()
     section = document.new_section(html_elem_attr={"id": "test_section"})
     document.write_section(section)
     expected = "\n".join([
         '<html>',
         '<head>',
         '<meta charset="utf-8">',
         '<title></title>',
         '<link rel="stylesheet" href="css/styles.css">',
         '</head>',
         '<body><div id="text_area"><div id="test_section"></div></div></body>',
         '</html>\n',
     ])
     assert str(document) == expected
Пример #3
0
 def test_empty_section_html_attributes(self, input, expected):
     document = create_empty_doc()
     section = document.new_section(html_elem_attr=input)
     assert str(section) == expected
Пример #4
0
 def test_wrong_html_element(self):
     document = create_empty_doc()
     with pytest.raises(AttributeError):
         document.new_section(html_elem="wrong")