def _get(self, endpoint): parts = endpoint.split("/") name = parts[1] fixture = self.FIXTURES / (name + ".html") with fixture.open() as f: return Page(self._url + endpoint, f.read(), {})
def _get_page(self, endpoint: str) -> Optional[Page]: parts = endpoint.split("/") name = parts[1] fixture = self.FIXTURES / (name + ".html") if not fixture.exists(): return with fixture.open(encoding="utf-8") as f: return Page(self._url + endpoint, f.read(), {})