@pytest.mark.skipif('not HAS_BEAUTIFUL_SOUP')
def test_htmlheader_start():
 f = 't/html.html'
 with open(f) as fd:
  table = fd.read()
 inputter = html.HTMLInputter()
 inputter.html = {}
 header = html.HTMLHeader()
 lines = inputter.get_lines(table)
 assert (str(lines[header.start_line(lines)]) == '<tr><th>Column 1</th><th>Column 2</th><th>Column 3</th></tr>')
 inputter.html['table_id'] = 'second'
 lines = inputter.get_lines(table)
 assert (str(lines[header.start_line(lines)]) == '<tr><th>Column A</th><th>Column B</th><th>Column C</th></tr>')
 inputter.html['table_id'] = 3
 lines = inputter.get_lines(table)
 assert (str(lines[header.start_line(lines)]) == '<tr><th>C1</th><th>C2</th><th>C3</th></tr>')
 lines = [html.SoupString(BeautifulSoup('<table><tr><td>Data</td></tr></table>').tr), html.SoupString(BeautifulSoup('<p>Text</p>').p)]
 assert (header.start_line(lines) is None)
 lines.append('<tr><th>Header</th></tr>')
 with pytest.raises(TypeError):
  header.start_line(lines)

@ pytest . mark . skipif ( 'not HAS_BEAUTIFUL_SOUP' ) def test_htmlheader_start ( ) : f = 't/html.html' with open ( f ) as fd : table = fd . read ( ) inputter = html . HTMLInputter ( ) inputter . html = { } header = html . HTMLHeader ( ) lines = inputter . get_lines ( table ) assert ( str ( lines [ header . start_line ( lines ) ] ) == '<tr><th>Column 1</th><th>Column 2</th><th>Column 3</th></tr>' ) inputter . html [ 'table_id' ] = 'second' lines = inputter . get_lines ( table ) assert ( str ( lines [ header . start_line ( lines ) ] ) == '<tr><th>Column A</th><th>Column B</th><th>Column C</th></tr>' ) inputter . html [ 'table_id' ] = 3 lines = inputter . get_lines ( table ) assert ( str ( lines [ header . start_line ( lines ) ] ) == '<tr><th>C1</th><th>C2</th><th>C3</th></tr>' ) lines = [ html . SoupString ( BeautifulSoup ( '<table><tr><td>Data</td></tr></table>' ) . tr ) , html . SoupString ( BeautifulSoup ( '<p>Text</p>' ) . p ) ] assert ( header . start_line ( lines ) is None ) lines . append ( '<tr><th>Header</th></tr>' ) with pytest . raises ( TypeError ) : header . start_line ( lines )
test to ensure that the start_line method of htmlheader returns the first line of header data .