@@ -0,0 +1,15 @@
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from apps.sources.adapters.jsonld import JsonLdJobPostingAdapter
|
||||
|
||||
|
||||
def test_extracts_sample_jobposting():
|
||||
html = Path("fixtures/pages/sample_jsonld_job.html").read_text(encoding="utf-8")
|
||||
expected = json.loads(Path("fixtures/golden/sample_jsonld_job.json").read_text())
|
||||
result = JsonLdJobPostingAdapter().extract(html, url="https://jobs.example.org/source")
|
||||
assert result.confidence >= 0.9
|
||||
assert len(result.jobs) == 1
|
||||
job = result.jobs[0]
|
||||
for key, value in expected.items():
|
||||
assert getattr(job, key) == value
|
||||
Reference in New Issue
Block a user