def test_parse_response_returns_beautifulsoup_object(self): """ _parse_response() should return a BeautifulSoup object. """ resp = Response() resp._content = self.example_html bs = scraper._parse_response(resp) assert isinstance(bs, BeautifulSoup)
def test_extract_names_table_returns_table(self): """ _extract_names_table() should return the correct BeautifulSoup table element. """ resp = Response() resp._content = self.example_html bs = scraper._parse_response(resp) table = scraper._extract_names_table(bs) assert "summary" in table.attrs assert table.attrs["summary"] == "Popularity for top 1000"