Ejemplo n.º 1
0
def test_t4():  # movie with highest score is returned
    mdata = deepcopy(data)
    mdata["friends"]["Maxim"] = ["Seven Samurai"]

    mrs = MovieRecommendationSystem(mdata)

    assert mrs.get_recommendation() in ("Schindler's List", "The Pianist")
Ejemplo n.º 2
0
def test_t2():  # unique is returned, unique movie is not paired
    mdata = deepcopy(data)
    mdata["friends"]["Maxim"] = ["Seven Samurai"]
    mdata["movies"].append("New Movie")

    mrs = MovieRecommendationSystem(mdata)

    assert mrs.get_recommendation() == "New Movie"
Ejemplo n.º 3
0
def test_t11():  # checking boundary conditions
    mdata = {
        "movies": ["The Matrix"],
        "movies_pairs": [],
        "friends": {
            "Ivan": ["The Matrix"]
        }
    }

    mrs = MovieRecommendationSystem(mdata)

    assert mrs.get_recommendation() == "The Matrix"
Ejemplo n.º 4
0
def test_t10():  # similar movie with highest score is returned
    mrs = MovieRecommendationSystem(data)

    assert mrs.get_recommendation("In Time") == "The Matrix"
Ejemplo n.º 5
0
def test_t8():  # similar movie with highest score is returned
    mrs = MovieRecommendationSystem(data)

    assert mrs.get_recommendation("Blade Runner") == "The Matrix"
Ejemplo n.º 6
0
def test_t6():  # similar movie with highest score is returned
    mrs = MovieRecommendationSystem(data)

    assert mrs.get_recommendation("Schindler's List") == "The Pianist"
Ejemplo n.º 7
0
def test_t5():  # similar movie with highest score is returned
    mrs = MovieRecommendationSystem(data)

    assert mrs.get_recommendation("Seven Samurai") in ("Gladiator", "Troy")
Ejemplo n.º 8
0
def test_t3():  # unique is returned if it's in similar list
    mrs = MovieRecommendationSystem(data)

    assert mrs.get_recommendation("Troy") == "Seven Samurai"
Ejemplo n.º 9
0
def test_t1(
):  # unique is returned, unique movie is paired (there is similar movie)
    mrs = MovieRecommendationSystem(data)

    assert mrs.get_recommendation() == "Seven Samurai"
Ejemplo n.º 10
0
def test_t15():  # checking boundary conditions
    mdata = {"movies_pairs": [], "friends": {}}

    with pytest.raises(Exception):
        mrs = MovieRecommendationSystem(mdata)
Ejemplo n.º 11
0
def test_t14():  # checking boundary conditions
    mdata = {"movies": [], "movies_pairs": [], "friends": {}}

    mrs = MovieRecommendationSystem(mdata)

    assert mrs.get_recommendation() == ""