def test_extract_names_from_row_raises_exception_when_too_many_tds(self):
     """
     _extract_names_from_row() should raise a IncorrectAmountOfTDElementsError if there are more
     than three td elements.
     """
     tr_html = '<tr align="right"><td>786</td><td>Ellis</td><td>Kaylah</td><td>foo</td></tr>'
     tr = BeautifulSoup(tr_html)
     with pytest.raises(scraper.IncorrectAmountOfTDElementsError):
         scraper._extract_names_from_row(tr)
 def test_extract_names_from_row_raises_exception_when_tds_are_out_of_order(self):
     """
     _extract_names_from_row() should raise a TDElementsOutOfOrderError if the tds are in a
     different order to what it expects and it would otherwise return a number as a name.
     """
     tr_html = '<tr align="right"><td>Ellis</td><td>786</td><td>Kaylah</td></tr>'
     tr = BeautifulSoup(tr_html)
     with pytest.raises(scraper.TDElementsOutOfOrderError):
         scraper._extract_names_from_row(tr)
 def test_extract_names_from_row(self):
     """
     _extract_names_from_row() should return a tuple of (<rank>, <boy_name>, <girl_name>) when
     given a BeautifulSoup 'tr' object.
     """
     tr_html = '<tr align="right"><td>786</td><td>Ellis</td><td>Kaylah</td></tr>'
     tr = BeautifulSoup(tr_html)
     rank, boy, girl = scraper._extract_names_from_row(tr)
     assert rank == 786
     assert boy == "Ellis"
     assert girl == "Kaylah"