def test_score_style(test_ramen_101, test_ramen_202, test_ramen_103, style_scorer): score_context = RamenContext(target_ramen=test_ramen_101) cand_202 = placeholder_ramen_candidate(test_ramen_202, context=score_context) cand_103 = placeholder_ramen_candidate(test_ramen_103, context=score_context) assert (style_scorer.score(candidate=cand_202) == 0 and style_scorer.score(candidate=cand_103) == 1)
def test_filter_same_brand(test_ramen_101, test_ramen_202, test_ramen_103, same_brand_filterer): score_context = RamenContext(target_ramen=test_ramen_101) cand_202 = placeholder_ramen_candidate(test_ramen_202, context=score_context) cand_103 = placeholder_ramen_candidate(test_ramen_103, context=score_context) assert not same_brand_filterer.filter( candidate=cand_202) and same_brand_filterer.filter(candidate=cand_103)
def test_score_rating(test_ramen_101, test_ramen_202, test_ramen_103, rating_scorer): score_context = RamenContext(target_ramen=test_ramen_101) cand_202 = placeholder_ramen_candidate(test_ramen_202, context=score_context) cand_103 = placeholder_ramen_candidate(test_ramen_103, context=score_context) assert (rating_scorer.score(candidate=cand_202) == cand_202.domain_object.rating / 5 and rating_scorer.score(candidate=cand_103) == cand_103.domain_object.rating / 5)
def test_score_likes_style(test_ramen_101, test_ramen_1011, likes_style_scorer, test_ramen_eater_01_context): cand_1011 = placeholder_ramen_candidate( test_ramen_1011, context=test_ramen_eater_01_context) cand_101 = placeholder_ramen_candidate(test_ramen_101, context=test_ramen_eater_01_context) assert likes_style_scorer.score(candidate=cand_101) == ( True, 1.1, ) and likes_style_scorer.score(candidate=cand_1011) == ( False, 0, )
def test_filter_prohibited_country( test_ramen_101, test_ramen_202, prohibited_country_filterer, test_ramen_eater_01_context, ): cand_202 = placeholder_ramen_candidate(test_ramen_202, context=test_ramen_eater_01_context) cand_101 = placeholder_ramen_candidate(test_ramen_101, context=test_ramen_eater_01_context) assert prohibited_country_filterer.filter( candidate=cand_202) and not prohibited_country_filterer.filter( candidate=cand_101)