diff --git a/src/mijnbib/parsers.py b/src/mijnbib/parsers.py index 01bd8d3..f7b081b 100644 --- a/src/mijnbib/parsers.py +++ b/src/mijnbib/parsers.py @@ -267,8 +267,6 @@ def parse(self) -> list[Account]: [Account(library_name='Dijk92', user='Johny', id='374047', loans_count=0, loans_url='https://example.com/mijn-bibliotheek/lidmaatschappen/374047/uitleningen', reservations_count=5, reservations_url='https://example.com/mijn-bibliotheek/lidmaatschappen/384767/reservaties', open_amounts=0, open_amounts_url='')] - >>> AccountsListPageParser("","https://example.com").parse() - [] """ accounts = [] soup = BeautifulSoup(self._html, "html.parser") @@ -432,8 +430,6 @@ def parse(self) -> list[Reservation]: [Reservation(title='Vastberaden!', type='', url='https://city.bibliotheek.be/resolver.ashx?extid=%7Cwise-oostvlaanderen%7C12345', author='John Doe', location='MyCity', available=False, available_till=None, request_on=datetime.date(2023, 11, 25), valid_till=datetime.date(2024, 11, 24))] - >>> ReservationsPageParser("").parse() # doctest: +NORMALIZE_WHITESPACE - [] """ holds = [] soup = BeautifulSoup(self._html, "html.parser") @@ -587,8 +583,6 @@ def _parse_extend_response_status_blob(cls, html_string: str) -> dict: {'likely_success': True, 'count': 2, 'details': [{'title': 'Vastberaden!', 'until': datetime.date(2024, 1, 13)}, {'title': 'Iemand moet het doen', 'until': datetime.date(2024, 1, 13)}]} - >>> ExtendResponsePageParser._parse_extend_response_status_blob("") - {'likely_success': False, 'count': 0, 'details': []} """ # NOTE: Unclear when & what response when no success (500 server crash on most tests with # different IDs and combinations) diff --git a/tests/test_parsers.py b/tests/test_parsers.py index b158fda..4602ac3 100644 --- a/tests/test_parsers.py +++ b/tests/test_parsers.py @@ -11,7 +11,7 @@ class TestAccountsListPageParser: def test_parse_accounts_list_page(self): # Happy flow test --> see doctest - assert AccountsListPageParser("", "").parse() == [] + assert AccountsListPageParser("", "https://example.com").parse() == [] def test_parse_item_count_from_li(self): assert AccountsListPageParser._parse_item_count_from_li("", "") is None @@ -61,6 +61,10 @@ def clean_whitespace(s: str) -> str: )._extract_html_from_response_script_tag() assert clean_whitespace(actual_result) == clean_whitespace(expected_result) + def test_parse_extend_response_status_blob__empty_case(self): + actual_result = ExtendResponsePageParser._parse_extend_response_status_blob("") + assert actual_result == {"likely_success": False, "count": 0, "details": []} + def test_parse_extend_response_status_blob__success_case(self): html_string = """