def test__get_page_info( self, query: str, expected_result: Dict[str, float], monkeypatch: MonkeyPatch, mock__search_page_by_title, mock__search_page_by_geo, mock__get_page_summary, mock__get_page_url, ) -> None: wikipedia: WikipediaApi = WikipediaApi() wiki_response = wikipedia.get_page_info("Fake title", query["coords"]) assert wiki_response == expected_result
def test__get_page_url(self, query: str, expected_result: Dict[str, float], monkeypatch: MonkeyPatch) -> None: class MockRequest: def __init__(self, *args: Any, **kwargs: Any) -> None: return None def json(self) -> Dict: return tests_variables.wiki_url_data monkeypatch.setattr(requests, "get", MockRequest) wikipedia: WikipediaApi = WikipediaApi() wiki_response = wikipedia._get_page_url(query) assert wiki_response == expected_result
def __init__(self) -> None: """App init method. """ self.google_maps: GoogleMapsApi = GoogleMapsApi() self.wikipedia: WikipediaApi = WikipediaApi() self.parser: SentenceParser = SentenceParser()