def test_append_header_row__implicit_head(self): table = Table() row = TableRow() table.append_header_row(row) assert_equal([ b"<table>", b"<thead>", b"<tr>", b"</tr>", b"</thead>", b"</table>" ], list(iter(table)))
def test_append_row__implicit_body(self): table = Table() row = TableRow() table.append_row(row) assert_equal([ b"<table>", b"<tbody>", b"<tr>", b"</tr>", b"</tbody>", b"</table>" ], list(iter(table)))
def test_create_head_and_body(self): table = Table() table.create_body() table.create_head() table.create_row() table.create_header_row() assert_equal( [ b"<table>", b"<thead>", b"<tr>", b"</tr>", b"</thead>", b"<tbody>", b"<tr>", b"</tr>", b"</tbody>", b"<tbody>", b"</tbody>", b"<thead>", b"</thead>", b"</table>", ], list(iter(table)), )
def test_create_simple_row(self): table = Table() table.create_simple_row("Col 1", "Col 2") assert_equal( "<table><tbody><tr><td>Col 1</td><td>Col 2</td></tr>" "</tbody></table>", str(table), )
def test_create_simple_header_row(self): table = Table() table.create_simple_header_row("Col 1", "Col 2") assert_equal( "<table><thead><tr><th>Col 1</th><th>Col 2</th></tr>" "</thead></table>", str(table), )
def test_children_order(self): table = Table() table.append_raw("<tr>Bare line</tr>") table.create_row() table.create_header_row() assert_equal([ b"<table>", b"<thead>", b"<tr>", b"</tr>", b"</thead>", b"<tbody>", b"<tr>", b"</tr>", b"</tbody>", b"<tr>Bare line</tr>", b"</table>" ], list(iter(table)))
def test_create_row__implicit_body(self): table = Table() table.create_row() assert_equal( [ b"<table>", b"<tbody>", b"<tr>", b"</tr>", b"</tbody>", b"</table>", ], list(iter(table)), )
def test_create_header_row__implicit_head(self): table = Table() table.create_header_row() assert_equal( [ b"<table>", b"<thead>", b"<tr>", b"</tr>", b"</thead>", b"</table>", ], list(iter(table)), )
def test_create_simple_row__returned_row(self): table = Table() row = table.create_simple_row() row.id = "test-id" assert_equal('<table><tbody><tr id="test-id"></tr></tbody></table>', str(table))
def test_empty(self): table = Table() assert_equal([b"<table>", b"</table>"], list(iter(table)))
def test_create_row__row_object(self): table = Table() row = table.create_row() row.id = "my-row" assert_equal([b'<tr id="my-row">', b"</tr>"], list(iter(row)))