This commit is contained in:
+17
-11
@@ -4,10 +4,9 @@ from decimal import Decimal
|
||||
|
||||
import pytest
|
||||
|
||||
from apps.jobs.models import AiAnalysisCache
|
||||
from apps.jobs.services.ai import AiAnalysis
|
||||
from apps.jobs.models import Employer, JobPosting, ScoreRun
|
||||
from apps.jobs.models import AiAnalysisCache, Employer, JobPosting, ScoreRun
|
||||
from apps.jobs.services import scoring
|
||||
from apps.jobs.services.ai import AiAnalysis
|
||||
from apps.jobs.services.scoring import calculate_score
|
||||
|
||||
|
||||
@@ -78,10 +77,12 @@ def test_distance_boundary_inclusief(matching_job, profile, monkeypatch):
|
||||
|
||||
def test_remote_job_heeft_geen_afstandsexclusie(matching_job, profile):
|
||||
matching_job.workplace_type = JobPosting.Workplace.REMOTE
|
||||
matching_job.postal_code = None
|
||||
matching_job.municipality = None
|
||||
matching_job.raw_location = None
|
||||
matching_job.save(update_fields=["workplace_type", "postal_code", "municipality", "raw_location"])
|
||||
matching_job.postal_code = ""
|
||||
matching_job.municipality = ""
|
||||
matching_job.raw_location = ""
|
||||
matching_job.save(
|
||||
update_fields=["workplace_type", "postal_code", "municipality", "raw_location"]
|
||||
)
|
||||
matching_job.latitude = None
|
||||
matching_job.longitude = None
|
||||
result = calculate_score(matching_job, profile)
|
||||
@@ -90,12 +91,14 @@ def test_remote_job_heeft_geen_afstandsexclusie(matching_job, profile):
|
||||
|
||||
|
||||
def test_onbekende_locatie_leidt_niet_tot_automatische_uitsluiting(matching_job, profile):
|
||||
matching_job.postal_code = None
|
||||
matching_job.municipality = None
|
||||
matching_job.postal_code = ""
|
||||
matching_job.municipality = ""
|
||||
matching_job.raw_location = "onbekend"
|
||||
matching_job.latitude = None
|
||||
matching_job.longitude = None
|
||||
matching_job.save(update_fields=["postal_code", "municipality", "raw_location", "latitude", "longitude"])
|
||||
matching_job.save(
|
||||
update_fields=["postal_code", "municipality", "raw_location", "latitude", "longitude"]
|
||||
)
|
||||
result = calculate_score(matching_job, profile)
|
||||
assert result.evidence["distance_km"] is None
|
||||
assert result.recommendation != ScoreRun.Recommendation.HIDDEN
|
||||
@@ -162,7 +165,10 @@ def test_ai_score_influence_is_opt_in_and_bounded(matching_job, profile, monkeyp
|
||||
)
|
||||
|
||||
result = calculate_score(matching_job, profile)
|
||||
assert result.recommendation in {ScoreRun.Recommendation.STRONG, ScoreRun.Recommendation.POSSIBLE}
|
||||
assert result.recommendation in {
|
||||
ScoreRun.Recommendation.STRONG,
|
||||
ScoreRun.Recommendation.POSSIBLE,
|
||||
}
|
||||
assert result.model_version == "local-model"
|
||||
assert result.evidence["ai"]["status"] == AiAnalysisCache.Status.OK
|
||||
assert result.evidence["ai"]["weight_applied"] == 20.0
|
||||
|
||||
Reference in New Issue
Block a user