Skip to content

Commit

Permalink
bundesanzeiger: black-format code and add path resolution to link test
Browse files Browse the repository at this point in the history
This resolves the path to response.html in test_get_next_page_link relative to __file__ (which should be the local path to the python test file). This should hopefully work on the CI server.

I also ran black ./src and black ./tests
  • Loading branch information
jfhr committed May 11, 2024
1 parent fc6146e commit dcc3a2b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/deutschland/bundesanzeiger/bundesanzeiger.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,7 @@ def __get_next_page_link(self, content: str):
if not next_link:
return None

return next_link.attrs.get('href')

return next_link.attrs.get("href")

def __generate_result(self, url: str, page_limit: int):
results = dict()
Expand Down
11 changes: 7 additions & 4 deletions tests/bundesanzeiger/test_parsing.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import os
from deutschland.bundesanzeiger import Bundesanzeiger


def test_get_next_page_link():
with open('response.html') as file:
ba = Bundesanzeiger()
html_file = os.path.join(os.path.dirname(__file__), "response.html")
with open(html_file) as file:
html = file.read()
link = ba._Bundesanzeiger__get_next_page_link(html)
assert link == 'https://www.bundesanzeiger.de/pub/de/suchen2?4-1.-top~nav-pager-navigation-1-pagination~link'
ba = Bundesanzeiger()
link = ba._Bundesanzeiger__get_next_page_link(html)
expected = "https://www.bundesanzeiger.de/pub/de/suchen2?4-1.-top~nav-pager-navigation-1-pagination~link"
assert link == expected

0 comments on commit dcc3a2b

Please sign in to comment.