def test_Head(): element = Head('data1') element.append('data2') with open('file5.html', 'w') as file1fh: element.render(file1fh) with open('file5.html', 'r') as filefh: rendered = filefh.read() assert '<head>\n'+element.indent+'data1\n'+element.indent+'data2\n'+'</head>\n' == rendered # noqa: E501
def test_head(): outfile = io.StringIO() e = Head("this is some text") e.append("and this is some more text") e.render(outfile) outfile.seek(0) file_contents = outfile.read() assert ("this is some text") in file_contents assert ("and this is some more text") in file_contents
def test_Head(): outfile = io.StringIO() e = Head('This is some text') e.append('This is some more text') e.render(outfile) outfile.seek(0) file_contents = outfile.read() print(file_contents) assert('This is some text') in file_contents assert('This is some more text') in file_contents assert file_contents.startswith("<head>") assert file_contents.strip().endswith("</head>")
def test_head(): test = Head(content='a head tag') f = StringIO() test.render(f) assert f.getvalue() == '<head>\n a head tag\n</head>\n'