mirror of
https://github.com/feder-cr/Jobs_Applier_AI_Agent.git
synced 2026-11-07 10:36:05 -10:00
scan: names without HTML entities, and the template says locations match as written
This commit is contained in:
1 parent
8cead59b7b
commit
04f93d3e5a
3 files changed
+13
-3
No files matched your search
@@ -33,7 +33,8 @@ goals: Describe the role, seniority, location and pay you are looking for.
|
||||
threshold: 4.0
|
||||
|
||||
# Keep a job only if its title holds one of `include` (required) and none of `exclude`, and its
|
||||
# location holds one of `locations`, in any language the posting uses. Older postings are left out.
|
||||
# location holds one of `locations`. Words are matched as written, so list every spelling you
|
||||
# want: italy, italia, milan, milano. Older postings are left out.
|
||||
filters:
|
||||
include: [Replace with words of the job titles you want]
|
||||
exclude: []
|
||||
|
||||
@@ -135,4 +135,8 @@ def search(location: str, filters: Filters, max_age_days: int) -> tuple[dict[str
|
||||
raise DatabaseError(f"the job database cannot be read: {error}") from error
|
||||
finally:
|
||||
connection.close()
|
||||
return manifest, [Job(key, company, title, place, url, url, text) for key, company, title, place, url, text in rows]
|
||||
# Some sources publish their names with HTML entities still in them.
|
||||
return manifest, [
|
||||
Job(key, html.unescape(company), html.unescape(title), html.unescape(place), url, url, text)
|
||||
for key, company, title, place, url, text in rows
|
||||
]
|
||||
+6
-1
@@ -19,7 +19,7 @@ def database(tmp_path: Path) -> str:
|
||||
rows = [
|
||||
("k1", "https://jobs.lever.co/a/1", "Senior Python Engineer", "Acme", "Rome, Italy", "Build", "2099-01-01"),
|
||||
("k2", "https://jobs.lever.co/a/2", "Python Intern", "Acme", "Berlin", "Learn", None),
|
||||
("k3", "https://example.com/3", "Accountant", "Beta", "Rome, Italy", "Count", "2099-01-01"),
|
||||
("k3", "https://example.com/3", "Accountant & Clerk", "B&A", "Rome, Italy", "Count", "2099-01-01"),
|
||||
("k4", "https://example.com/4", "Python Developer", "Old", "Rome, Italy", "Past", "2001-01-01"),
|
||||
]
|
||||
connection = duckdb.connect()
|
||||
@@ -45,6 +45,11 @@ def test_search_keeps_what_the_filters_say_and_leaves_out_what_is_old(tmp_path:
|
||||
assert [job.title for job in jobs] == titles
|
||||
|
||||
|
||||
def test_names_come_without_html_entities(tmp_path: Path) -> None:
|
||||
_, jobs = search(database(tmp_path), Filters(include=("accountant",)), max_age_days=60)
|
||||
assert [(job.title, job.company) for job in jobs] == [("Accountant & Clerk", "B&A")]
|
||||
|
||||
|
||||
def test_search_needs_titles_and_says_so(tmp_path: Path) -> None:
|
||||
with pytest.raises(DatabaseError, match="filters.include"):
|
||||
search(database(tmp_path), Filters(), max_age_days=60)
|
||||
|
||||
Reference in new issue
Block a user