コード例 #1
0
def test_review_methods():
    user1 = "user1"
    user2 = "user2"
    movie = Movie("Moana", 2016)
    review_text = "This movie was very enjoyable."
    rating = 8
    review1 = Review(user1, movie, review_text, rating)

    movie = Movie("Moana", 2016)
    review_text = "This movie was very enjoyable."
    rating = 8
    review2 = Review(user1, movie, review_text, rating)

    movie = Movie("Cats", 2016)
    review_text = "This movie was very lame."
    rating = 4
    review3 = Review(user2, movie, review_text, rating)

    assert review1.__eq__(review2) == True
    assert review1.__eq__(review1) == True
    assert review1.__eq__(review3) == False
コード例 #2
0
def test_review_3_false_eq_function():
    movie1 = Movie("Princess and The Frog", 2009)
    review1 = Review(movie1, "I really liked it", 9)
    review2 = Review(movie1, "I really liked it", 8)
    assert review1.__eq__(review2) is False