@pytest.mark.skipif('not HAS_BEAUTIFUL_SOUP')
def test_identify_table():
 soup = BeautifulSoup('<html><body></body></html>')
 assert (html.identify_table(soup, {}, 0) is False)
 assert (html.identify_table(None, {}, 0) is False)
 soup = BeautifulSoup('<table id="foo"><tr><th>A</th></tr><tr><td>B</td></tr></table>').table
 assert (html.identify_table(soup, {}, 2) is False)
 assert (html.identify_table(soup, {}, 1) is True)
 assert (html.identify_table(soup, {'table_id': 2}, 1) is False)
 assert (html.identify_table(soup, {'table_id': 1}, 1) is True)
 assert (html.identify_table(soup, {'table_id': 'bar'}, 1) is False)
 assert (html.identify_table(soup, {'table_id': 'foo'}, 1) is True)

@ pytest . mark . skipif ( 'not HAS_BEAUTIFUL_SOUP' ) def test_identify_table ( ) : soup = BeautifulSoup ( '<html><body></body></html>' ) assert ( html . identify_table ( soup , { } , 0 ) is False ) assert ( html . identify_table ( None , { } , 0 ) is False ) soup = BeautifulSoup ( '<table id="foo"><tr><th>A</th></tr><tr><td>B</td></tr></table>' ) . table assert ( html . identify_table ( soup , { } , 2 ) is False ) assert ( html . identify_table ( soup , { } , 1 ) is True ) assert ( html . identify_table ( soup , { 'table_id' : 2 } , 1 ) is False ) assert ( html . identify_table ( soup , { 'table_id' : 1 } , 1 ) is True ) assert ( html . identify_table ( soup , { 'table_id' : 'bar' } , 1 ) is False ) assert ( html . identify_table ( soup , { 'table_id' : 'foo' } , 1 ) is True )
test to make sure that identify_table() returns whether the given beautifulsoup tag is the correct table to process .