Beispiel #1
0
def _get_from_web(year, url):
    """Retrieve data from url for following year

    :param year: get data from following year
    :type year: str
    :param url: url where get data from
    :type url: str
    :returns: data from web, names with ranks
    :rtype: ({}, {})

    """
    return scraper.get(year, url)
 def test_get_returns_tuple_of_dicts_for_boy_and_girl(self):
     """
     get() should return a tuple containing a dictionary for boy's and girl's names
     respectively. The dicts should have the names as keys and their rank as values.
     """
     fake_resp = Response()
     fake_resp._content = self.example_html
     with patch.object(Session, "send", return_value=fake_resp):
         boys, girls = scraper.get(year=2000, url=LOCAL_URL)
     assert isinstance(boys, dict)
     assert isinstance(girls, dict)
     assert "Ellis" in boys
     assert "Yolanda" in girls
     assert boys["Ellis"] == 786
     assert girls["Yolanda"] == 780