Пример #1
0
    def test_cache_count_ratings(self):
        recom_helper = RecomHelper()
        ratings_count = recom_helper.count_ratings(self.u3.id)
        self.assertEquals(ratings_count, 15)

        save_rating(self.f1, self.u3, 1)
        ratings_count = recom_helper.count_ratings(self.u3.id)
        self.assertEquals(ratings_count, 16)
Пример #2
0
    def test_cache_count_ratings(self):
        recom_helper = RecomHelper()
        ratings_count = recom_helper.count_ratings(self.u3.id)
        self.assertEquals(ratings_count, 15)

        save_rating(self.f1, self.u3, 1)
        ratings_count = recom_helper.count_ratings(self.u3.id)
        self.assertEquals(ratings_count, 16)
Пример #3
0
    def setUp(self):
        User.objects.all().delete()
        Film.objects.all().delete()
        Rating.objects.all().delete()
        ShortReview.objects.all().delete()

        #create sample user
        user1 = User.objects.create_user('michuk', '*****@*****.**',
                                         'secret')
        user1.save()
        user2 = User.objects.create_user('john', '*****@*****.**',
                                         'secret')
        user2.save()

        tags = "science-fiction comedy"

        #create sample user rating
        film1 = Film()
        film1.title = "Battlefield Earth II"
        film1.type = Object.TYPE_FILM
        film1.permalink = "battlefirld-earth-ii"
        film1.release_year = 2010
        film1.production_country_list = "USA"
        film1.save()
        film1.save_tags(tags, LANG="pl", saved_by=2)

        film2 = Film()
        film2.title = "Battlefield Earth III"
        film2.type = Object.TYPE_FILM
        film2.permalink = "battlefirld-earth-iii"
        film2.release_year = 2011
        film2.production_country_list = "USA"
        film2.save()
        film2.save_tags(tags, LANG="pl", saved_by=2)

        film3 = Film()
        film3.title = "Battlefield Earth IV"
        film3.type = Object.TYPE_FILM
        film3.permalink = "battlefirld-earth-iv"
        film3.release_year = 2012
        film3.production_country_list = "Italy"
        film3.save()
        film3.save_tags(tags, LANG="pl", saved_by=2)

        film4 = Film()
        film4.title = "Battlefield Earth V"
        film4.type = Object.TYPE_FILM
        film4.permalink = "battlefirld-earth-v"
        film4.release_year = 2013
        film4.production_country_list = "UK"
        film4.save()
        film4.save_tags(tags, LANG="pl", saved_by=2)

        # set up test user ratings
        save_rating(film1, user1, 1)
        save_rating(film2, user1, 3)
        save_rating(film3, user1, 4)
        save_rating(film4, user1, 6)

        save_rating(film2, user2, 2)
        save_rating(film3, user2, 3)
        save_rating(film4, user2, 5)

        users = User.objects.all()
        self.assertEquals(len(users), 2)

        films = Film.objects.all()
        self.assertEquals(len(films), 4)

        user1 = users[0].id
        ratings1 = Rating.objects.filter(Q(user=user1))
        self.assertEquals(len(ratings1), 4)

        user2 = users[1].id
        ratings2 = Rating.objects.filter(Q(user=user2))
        self.assertEquals(len(ratings2), 3)

        reviews1 = ShortReview.objects.filter(Q(user=user1))
        self.assertEquals(len(reviews1), 0)

        reviews2 = ShortReview.objects.filter(Q(user=user2))
        self.assertEquals(len(reviews2), 0)
Пример #4
0
    def setUp(self):
        User.objects.all().delete()

        Object.objects.all().delete()
        Film.objects.all().delete()
        FilmLog.objects.all().delete()
        Rating.objects.all().delete()
        Recommendation.objects.all().delete()
        Person.objects.all().delete()

        AddedCharacter.objects.all().delete()
        AddedFilm.objects.all().delete()

        # set up users
        self.u1 = User(username="******", email="*****@*****.**")
        self.u1.save()

        self.u2 = User.objects.create_user("root", "*****@*****.**", "root")
        self.u2.user_permissions.add(Permission.objects.get(codename="can_accept_added_films"))
        self.u2.save()

        self.u3 = User(username="******", email="*****@*****.**")
        self.u3.save()

        self.u4 = User(username="******", email="*****@*****.**")
        self.u4.save()

        self.u5 = User(username="******", email="*****@*****.**")
        self.u5.save()

        self.u6 = User(username="******", email="*****@*****.**")
        self.u6.save()

        # some persons
        self.p1 = Person(name="Clint", surname="Eastwood", imdb_code=None, type=Person.TYPE_PERSON)
        self.p1.save()

        self.p2 = Person(name="Sylvester", surname="Stallone", imdb_code=None, type=Person.TYPE_PERSON)
        self.p2.save()

        self.p3 = Person(name="Jack", surname="Mort", imdb_code=None, type=Person.TYPE_PERSON)
        self.p3.save()

        # set up films
        self.f1 = Film(
            type=1,
            permalink="przypadek",
            imdb_code=111,
            status=1,
            version=1,
            release_year=1999,
            title="Przypadek",
            popularity=20,
            popularity_month=10,
        )
        self.f1.save()

        self.f2 = Film(
            type=1,
            permalink="wrestler",
            imdb_code=112,
            status=1,
            version=1,
            release_year=2008,
            title="Wrestler",
            popularity=10,
            popularity_month=1,
        )
        self.f2.save()

        self.f3 = Film(
            type=1,
            permalink="american-history-x",
            imdb_code=113,
            status=1,
            version=1,
            release_year=1998,
            title="American History X",
            popularity=1,
            popularity_month=1,
        )
        self.f3.save()

        self.f4 = Film(
            type=1,
            permalink="the-big-lebowski",
            imdb_code=114,
            status=1,
            version=1,
            release_year=1998,
            title="The Big Lebowski",
            popularity=1,
            popularity_month=1,
        )
        self.f4.save()

        self.f5 = Film(
            type=1,
            permalink="the-lord-of-the-rings-the-fellowship-of-the-ring",
            imdb_code=115,
            status=1,
            version=1,
            release_year=2001,
            title="The Lord of the Rings: The Fellowship of the Ring",
            popularity=1,
            popularity_month=1,
        )
        self.f5.save()

        self.f6 = Film(
            type=1,
            permalink="raiders-of-the-lost-ark",
            imdb_code=116,
            status=1,
            version=1,
            release_year=1981,
            title="Raiders of the Lost Ark",
            popularity=1,
            popularity_month=1,
        )
        self.f6.save()

        self.f7 = Film(
            type=1,
            permalink="the-alien",
            imdb_code=117,
            status=1,
            version=1,
            release_year=1979,
            title="The Alien",
            popularity=1,
            popularity_month=1,
        )
        self.f7.save()

        self.f8 = Film(
            type=1,
            permalink="terminator-2-judgment-day",
            imdb_code=118,
            status=1,
            version=1,
            release_year=1991,
            title="Terminator 2: Judgment Day",
            popularity=1,
            popularity_month=1,
        )
        self.f8.save()

        self.f9 = Film(
            type=1,
            permalink="przypadek",
            imdb_code=119,
            status=1,
            version=1,
            release_year=1999,
            title="Przypadek",
            popularity=20,
            popularity_month=10,
        )
        self.f9.save()

        self.f10 = Film(
            type=1,
            permalink="wrestler",
            imdb_code=120,
            status=1,
            version=1,
            release_year=2008,
            title="Wrestler",
            popularity=10,
            popularity_month=1,
        )
        self.f10.save()

        self.f11 = Film(
            type=1,
            permalink="american-history-x",
            imdb_code=121,
            status=1,
            version=1,
            release_year=1998,
            title="American History X",
            popularity=1,
            popularity_month=1,
        )
        self.f11.save()

        self.f12 = Film(
            type=1,
            permalink="the-big-lebowski",
            imdb_code=122,
            status=1,
            version=1,
            release_year=1998,
            title="The Big Lebowski",
            popularity=1,
            popularity_month=1,
        )
        self.f12.save()

        self.f13 = Film(
            type=1,
            permalink="the-lord-of-the-rings-the-fellowship-of-the-ring",
            imdb_code=123,
            status=1,
            version=1,
            release_year=2001,
            title="The Lord of the Rings: The Fellowship of the Ring",
            popularity=1,
            popularity_month=1,
        )
        self.f13.save()

        self.f14 = Film(
            type=1,
            permalink="raiders-of-the-lost-ark",
            imdb_code=124,
            status=1,
            version=1,
            release_year=1981,
            title="Raiders of the Lost Ark",
            popularity=1,
            popularity_month=1,
        )
        self.f14.save()

        self.f15 = Film(
            type=1,
            permalink="the-alien",
            imdb_code=125,
            status=1,
            version=1,
            release_year=1979,
            title="The Alien",
            popularity=1,
            popularity_month=1,
        )
        self.f15.save()

        self.f16 = Film(
            type=1,
            permalink="przypadek",
            imdb_code=126,
            status=1,
            version=1,
            release_year=1999,
            title="Przypadek",
            popularity=20,
            popularity_month=10,
        )
        self.f16.save()

        self.f17 = Film(
            type=1,
            permalink="wrestler",
            imdb_code=127,
            status=1,
            version=1,
            release_year=2008,
            title="Wrestler",
            popularity=10,
            popularity_month=1,
        )
        self.f17.save()

        self.f18 = Film(
            type=1,
            permalink="american-history-x",
            imdb_code=128,
            status=1,
            version=1,
            release_year=1998,
            title="American History X",
            popularity=1,
            popularity_month=1,
        )
        self.f18.save()

        self.f19 = Film(
            type=1,
            permalink="the-big-lebowski",
            imdb_code=129,
            status=1,
            version=1,
            release_year=1998,
            title="The Big Lebowski",
            popularity=1,
            popularity_month=1,
        )
        self.f19.save()

        self.f20 = Film(
            type=1,
            permalink="the-lord-of-the-rings-the-fellowship-of-the-ring",
            imdb_code=130,
            status=1,
            version=1,
            release_year=2001,
            title="The Lord of the Rings: The Fellowship of the Ring",
            popularity=1,
            popularity_month=1,
        )
        self.f20.save()

        self.f21 = Film(
            type=1,
            permalink="raiders-of-the-lost-ark",
            imdb_code=131,
            status=1,
            version=1,
            release_year=1981,
            title="Raiders of the Lost Ark",
            popularity=1,
            popularity_month=1,
        )
        self.f21.save()

        self.f22 = Film(
            type=1,
            permalink="the-alien",
            imdb_code=132,
            status=1,
            version=1,
            release_year=1979,
            title="The Alien",
            popularity=1,
            popularity_month=1,
        )
        self.f22.save()

        self.f23 = Film(
            type=1,
            permalink="terminator-2-judgment-day",
            imdb_code=133,
            status=1,
            version=1,
            release_year=1991,
            title="Terminator 2: Judgment Day",
            popularity=1,
            popularity_month=1,
        )
        self.f23.save()

        self.f24 = Film(
            type=1,
            permalink="przypadek",
            imdb_code=134,
            status=1,
            version=1,
            release_year=1999,
            title="Przypadek",
            popularity=20,
            popularity_month=10,
        )
        self.f24.save()

        self.f25 = Film(
            type=1,
            permalink="wrestler",
            imdb_code=135,
            status=1,
            version=1,
            release_year=2008,
            title="Wrestler",
            popularity=10,
            popularity_month=1,
        )
        self.f25.save()

        self.f26 = Film(
            type=1,
            permalink="american-history-x",
            imdb_code=136,
            status=1,
            version=1,
            release_year=1998,
            title="American History X",
            popularity=1,
            popularity_month=1,
        )
        self.f26.save()

        self.f27 = Film(
            type=1,
            permalink="the-big-lebowski",
            imdb_code=137,
            status=1,
            version=1,
            release_year=1998,
            title="The Big Lebowski",
            popularity=1,
            popularity_month=1,
        )
        self.f27.save()

        self.f28 = Film(
            type=1,
            permalink="the-lord-of-the-rings-the-fellowship-of-the-ring",
            imdb_code=138,
            status=1,
            version=1,
            release_year=2001,
            title="The Lord of the Rings: The Fellowship of the Ring",
            popularity=1,
            popularity_month=1,
        )
        self.f28.save()

        self.f29 = Film(
            type=1,
            permalink="raiders-of-the-lost-ark",
            imdb_code=139,
            status=1,
            version=1,
            release_year=1981,
            title="Raiders of the Lost Ark",
            popularity=1,
            popularity_month=1,
        )
        self.f29.save()

        self.f30 = Film(
            type=1,
            permalink="the-alien",
            imdb_code=140,
            status=1,
            version=1,
            release_year=1979,
            title="The Alien",
            popularity=1,
            popularity_month=1,
        )
        self.f30.save()

        self.f31 = AddedFilm(
            title="Added film part 1", localized_title="Added film PL", release_year=2010, user=self.u1
        )
        self.f31.save()

        self.f31.directors.add(self.p1)
        self.f31.save()

        AddedCharacter.objects.create(added_film=self.f31, person=self.p3, character="Jack Mort")

        self.f31.accept(self.u2)

        self.f32 = AddedFilm(
            title="Added film part 2", localized_title="Added film PL", release_year=2010, user=self.u1
        )
        self.f32.save()

        self.f32.directors.add(self.p2)
        self.f32.save()

        AddedCharacter.objects.create(added_film=self.f32, person=self.p3, character="Jack Mort")

        self.f32.accept(self.u2)

        # tagging
        self.f1.save_tags("comedy drama horror animation mystery")
        self.f2.save_tags("comedy sci-fi thriller series")
        self.f3.save_tags("comedy")
        self.f4.save_tags("sci-fi")
        self.f5.save_tags("horror")
        self.f6.save_tags("thriller")
        self.f7.save_tags("drama")
        self.f8.save_tags("series")
        self.f9.save_tags("sci-fi")
        self.f10.save_tags("fantasy")
        self.f11.save_tags("mystery")
        self.f12.save_tags("action")
        self.f13.save_tags("adventure")
        self.f14.save_tags("animation")
        self.f15.save_tags("family")
        self.f16.save_tags("thriller")
        self.f17.save_tags("drama")
        self.f18.save_tags("series")
        self.f19.save_tags("sci-fi")
        self.f20.save_tags("fantasy")
        self.f21.save_tags("comedy")
        self.f22.save_tags("animation")
        self.f23.save_tags("comedy")
        self.f24.save_tags("sci-fi")
        self.f25.save_tags("horror")
        self.f26.save_tags("thriller")
        self.f27.save_tags("drama")
        self.f28.save_tags("series")
        self.f29.save_tags("sci-fi")
        self.f30.save_tags("fantasy")

        # First user ratings
        save_rating(self.f1, self.u1, 1)
        save_rating(self.f2, self.u1, 2)
        save_rating(self.f3, self.u1, 3)
        save_rating(self.f4, self.u1, 4)
        save_rating(self.f5, self.u1, 5)
        save_rating(self.f6, self.u1, 6)
        save_rating(self.f7, self.u1, 7)
        save_rating(self.f8, self.u1, 8)
        save_rating(self.f9, self.u1, 9)
        save_rating(self.f10, self.u1, 10)
        save_rating(self.f11, self.u1, 1)
        save_rating(self.f12, self.u1, 2)
        save_rating(self.f13, self.u1, 3)
        save_rating(self.f14, self.u1, 4)
        save_rating(self.f15, self.u1, 5)
        save_rating(self.f16, self.u1, 6)
        save_rating(self.f17, self.u1, 7)
        save_rating(self.f18, self.u1, 8)
        save_rating(self.f19, self.u1, 9)
        save_rating(self.f20, self.u1, 10)
        save_rating(self.f21, self.u1, 1)
        save_rating(self.f22, self.u1, 2)
        save_rating(self.f23, self.u1, 3)
        save_rating(self.f24, self.u1, 4)
        save_rating(self.f25, self.u1, 5)
        save_rating(self.f26, self.u1, 6)
        save_rating(self.f27, self.u1, 7)
        save_rating(self.f28, self.u1, 8)
        save_rating(self.f29, self.u1, 9)
        save_rating(self.f30, self.u1, 10)

        # Second user ratings - more than minimal common films requirement (15)
        save_rating(self.f1, self.u2, 1)
        save_rating(self.f2, self.u2, 2)
        save_rating(self.f3, self.u2, 3)
        save_rating(self.f4, self.u2, 4)
        save_rating(self.f5, self.u2, 5)
        save_rating(self.f6, self.u2, 6)
        save_rating(self.f7, self.u2, 7)
        save_rating(self.f8, self.u2, 8)
        save_rating(self.f9, self.u2, 9)
        save_rating(self.f10, self.u2, 10)
        save_rating(self.f11, self.u2, 1)
        # save_rating(self.f12, self.u2, 2)
        save_rating(self.f13, self.u2, 3)
        # save_rating(self.f14, self.u2, 4)
        save_rating(self.f15, self.u2, 5)
        # save_rating(self.f16, self.u2, 6)
        save_rating(self.f17, self.u2, 7)
        # save_rating(self.f18, self.u2, 8)
        save_rating(self.f19, self.u2, 9)
        # save_rating(self.f20, self.u2, 10)
        save_rating(self.f21, self.u2, 1)
        # save_rating(self.f22, self.u2, 2)
        save_rating(self.f23, self.u2, 3)
        # save_rating(self.f24, self.u2, 4)
        save_rating(self.f25, self.u2, 5)
        # save_rating(self.f26, self.u2, 6)
        save_rating(self.f27, self.u2, 7)
        # save_rating(self.f28, self.u2, 8)
        save_rating(self.f29, self.u2, 9)
        # save_rating(self.f30, self.u2, 10)

        # Third user ratings - equal with minimal common films requirement (15)
        # save_rating(self.f1, self.u3, 1)
        # save_rating(self.f2, self.u3, 2)
        # save_rating(self.f3, self.u3, 3)
        # save_rating(self.f4, self.u3, 4)
        # save_rating(self.f5, self.u3, 5)
        # save_rating(self.f6, self.u3, 6)
        # save_rating(self.f7, self.u3, 7)
        # save_rating(self.f8, self.u3, 8)
        # save_rating(self.f9, self.u3, 9)
        # save_rating(self.f10, self.u3, 10)
        # save_rating(self.f11, self.u3, 1)
        # save_rating(self.f12, self.u3, 2)
        # save_rating(self.f13, self.u3, 3)
        # save_rating(self.f14, self.u3, 4)
        # save_rating(self.f15, self.u3, 5)
        save_rating(self.f16, self.u3, 6)
        save_rating(self.f17, self.u3, 7)
        save_rating(self.f18, self.u3, 8)
        save_rating(self.f19, self.u3, 9)
        save_rating(self.f20, self.u3, 10)
        save_rating(self.f21, self.u3, 1)
        save_rating(self.f22, self.u3, 2)
        save_rating(self.f23, self.u3, 3)
        save_rating(self.f24, self.u3, 4)
        save_rating(self.f25, self.u3, 5)
        save_rating(self.f26, self.u3, 6)
        save_rating(self.f27, self.u3, 7)
        save_rating(self.f28, self.u3, 8)
        save_rating(self.f29, self.u3, 9)
        save_rating(self.f30, self.u3, 10)

        # Fourth user ratings - less than minimal films requirement
        # save_rating(self.f1, self.u4, 1)
        # save_rating(self.f2, self.u4, 2)
        # save_rating(self.f3, self.u4, 3)
        # save_rating(self.f4, self.u4, 4)
        # save_rating(self.f5, self.u4, 5)
        # save_rating(self.f6, self.u4, 6)
        # save_rating(self.f7, self.u4, 7)
        # save_rating(self.f8, self.u4, 8)
        # save_rating(self.f9, self.u4, 9)
        # save_rating(self.f10, self.u4, 10)
        # save_rating(self.f11, self.u4, 1)
        # save_rating(self.f12, self.u4, 2)
        # save_rating(self.f13, self.u4, 3)
        # save_rating(self.f14, self.u4, 4)
        # save_rating(self.f15, self.u4, 5)
        # save_rating(self.f16, self.u4, 6)
        # save_rating(self.f17, self.u4, 7)
        # save_rating(self.f18, self.u4, 8)
        # save_rating(self.f19, self.u4, 9)
        # save_rating(self.f20, self.u4, 10)
        save_rating(self.f21, self.u4, 1)
        save_rating(self.f22, self.u4, 2)
        save_rating(self.f23, self.u4, 3)
        save_rating(self.f24, self.u4, 4)
        save_rating(self.f25, self.u4, 5)
        save_rating(self.f26, self.u4, 6)
        save_rating(self.f27, self.u4, 7)
        save_rating(self.f28, self.u4, 8)
        save_rating(self.f29, self.u4, 9)
        save_rating(self.f30, self.u4, 10)

        # Fifth user ratings - the same films rated (1st and 5th user) but different
        # ratings
        # save_rating(self.f1, self.u5, 10)
        # save_rating(self.f2, self.u5, 9)
        # save_rating(self.f3, self.u5, 8)
        # save_rating(self.f4, self.u5, 7)
        # save_rating(self.f5, self.u5, 6)
        # save_rating(self.f6, self.u5, 5)
        # save_rating(self.f7, self.u5, 4)
        # save_rating(self.f8, self.u5, 3)
        # save_rating(self.f9, self.u5, 2)
        # save_rating(self.f10, self.u5, 1)
        # save_rating(self.f11, self.u5, 10)
        # save_rating(self.f12, self.u5, 9)
        # save_rating(self.f13, self.u5, 8)
        # save_rating(self.f14, self.u5, 7)
        # save_rating(self.f15, self.u5, 6)
        # save_rating(self.f16, self.u5, 5)
        # save_rating(self.f17, self.u5, 4)
        # save_rating(self.f18, self.u5, 3)
        # save_rating(self.f19, self.u5, 2)
        # save_rating(self.f20, self.u5, 1)
        # save_rating(self.f21, self.u5, 10)
        # save_rating(self.f22, self.u5, 9)
        # save_rating(self.f23, self.u5, 8)
        # save_rating(self.f24, self.u5, 7)
        # save_rating(self.f25, self.u5, 6)
        # save_rating(self.f26, self.u5, 5)
        # save_rating(self.f27, self.u5, 4)
        # save_rating(self.f28, self.u5, 3)
        # save_rating(self.f29, self.u5, 2)
        # save_rating(self.f30, self.u5, 1)

        # Sixth user ratings - the same films rated (1st and 5th user) but different
        # ratings
        save_rating(self.f1, self.u6, 10)
        save_rating(self.f2, self.u6, 10)
        save_rating(self.f3, self.u6, 10)
        save_rating(self.f4, self.u6, 10)
        save_rating(self.f5, self.u6, 10)
        save_rating(self.f6, self.u6, 10)
        save_rating(self.f7, self.u6, 10)
        save_rating(self.f8, self.u6, 10)
        save_rating(self.f9, self.u6, 10)
        save_rating(self.f10, self.u6, 10)
        save_rating(self.f11, self.u6, 10)
        save_rating(self.f12, self.u6, 10)
        save_rating(self.f13, self.u6, 10)
        save_rating(self.f14, self.u6, 10)
        save_rating(self.f15, self.u6, 10)
        save_rating(self.f16, self.u6, 10)
        save_rating(self.f17, self.u6, 10)
        save_rating(self.f18, self.u6, 10)
        save_rating(self.f19, self.u6, 10)
        save_rating(self.f20, self.u6, 10)
        save_rating(self.f21, self.u6, 10)
        save_rating(self.f22, self.u6, 10)
        save_rating(self.f23, self.u6, 10)
        save_rating(self.f24, self.u6, 10)
        save_rating(self.f25, self.u6, 10)
        save_rating(self.f26, self.u6, 10)
        save_rating(self.f27, self.u6, 10)
        save_rating(self.f28, self.u6, 10)
        save_rating(self.f29, self.u6, 10)
        save_rating(self.f30, self.u6, 10)
Пример #5
0
    def setUp(self):
        User.objects.all().delete()
        Film.objects.all().delete()
        Rating.objects.all().delete()
        ShortReview.objects.all().delete()

        #create sample user
        user1 = User.objects.create_user('michuk',
                                       '*****@*****.**',
                                       'secret')
        user1.save()
        user2 = User.objects.create_user('john',
                                       '*****@*****.**',
                                       'secret')
        user2.save()

        tags = "science-fiction comedy"

        #create sample user rating
        film1 = Film()
        film1.title = "Battlefield Earth II"
        film1.type = Object.TYPE_FILM
        film1.permalink = "battlefirld-earth-ii"
        film1.release_year = 2010
        film1.production_country_list = "USA"
        film1.save()
        film1.save_tags(tags, LANG="pl", saved_by=2)

        film2 = Film()
        film2.title = "Battlefield Earth III"
        film2.type = Object.TYPE_FILM
        film2.permalink = "battlefirld-earth-iii"
        film2.release_year = 2011
        film2.production_country_list = "USA"
        film2.save()
        film2.save_tags(tags, LANG="pl", saved_by=2)

        film3 = Film()
        film3.title = "Battlefield Earth IV"
        film3.type = Object.TYPE_FILM
        film3.permalink = "battlefirld-earth-iv"
        film3.release_year = 2012
        film3.production_country_list = "Italy"
        film3.save()
        film3.save_tags(tags, LANG="pl", saved_by=2)

        film4 = Film()
        film4.title = "Battlefield Earth V"
        film4.type = Object.TYPE_FILM
        film4.permalink = "battlefirld-earth-v"
        film4.release_year = 2013
        film4.production_country_list = "UK"
        film4.save()
        film4.save_tags(tags, LANG="pl", saved_by=2)

        
        # set up test user ratings
        save_rating(film1, user1, 1)
        save_rating(film2, user1, 3)
        save_rating(film3, user1, 4)
        save_rating(film4, user1, 6)

        save_rating(film2, user2, 2)
        save_rating(film3, user2, 3)
        save_rating(film4, user2, 5)

        users = User.objects.all()
        self.assertEquals(len(users), 2)

        films = Film.objects.all()
        self.assertEquals(len(films), 4)

        user1 = users[0].id
        ratings1 = Rating.objects.filter(Q(user=user1))
        self.assertEquals(len(ratings1), 4)

        user2 = users[1].id
        ratings2 = Rating.objects.filter(Q(user=user2))
        self.assertEquals(len(ratings2), 3)

        reviews1 = ShortReview.objects.filter(Q(user=user1))
        self.assertEquals(len(reviews1), 0)

        reviews2 = ShortReview.objects.filter(Q(user=user2))
        self.assertEquals(len(reviews2), 0)
Пример #6
0
    def films_for_comparator(self):
        # films for comnparator
        self.f1 = Film(type=1, permalink='przypadek', imdb_code=111, status=1, version=1,
            release_year=1999, title='Przypadek', popularity=20, popularity_month=10)
        self.f1.save()

        self.f2 = Film(type=1, permalink='wrestler', imdb_code=112, status=1, version=1,
            release_year=2008, title='Wrestler', popularity=10, popularity_month=1)
        self.f2.save()

        self.f3 = Film(type=1, permalink='american-history-x', imdb_code=113, status=1, version=1,
            release_year=1998, title='American History X', popularity=1, popularity_month=1)
        self.f3.save()

        self.f4 = Film(type=1, permalink='the-big-lebowski', imdb_code=114, status=1, version=1,
            release_year=1998, title='The Big Lebowski', popularity=1, popularity_month=1)
        self.f4.save()

        self.f5 = Film(type=1, permalink='the-lord-of-the-rings-the-fellowship-of-the-ring', imdb_code=115, status=1, version=1,
            release_year=2001, title='The Lord of the Rings: The Fellowship of the Ring', popularity=1, popularity_month=1)
        self.f5.save()

        self.f6 = Film(type=1, permalink='raiders-of-the-lost-ark', imdb_code=116, status=1, version=1,
            release_year=1981, title='Raiders of the Lost Ark', popularity=1, popularity_month=1)
        self.f6.save()

        self.f7 = Film(type=1, permalink='the-alien', imdb_code=117, status=1, version=1,
            release_year=1979, title='The Alien', popularity=1, popularity_month=1)
        self.f7.save()

        self.f8 = Film(type=1, permalink='terminator-2-judgment-day', imdb_code=118, status=1, version=1,
        release_year=1991, title='Terminator 2: Judgment Day', popularity=1, popularity_month=1)
        self.f8.save()

        self.f9 = Film(type=1, permalink='przypadek', imdb_code=119, status=1, version=1,
            release_year=1999, title='Przypadek', popularity=20, popularity_month=10)
        self.f9.save()

        self.f10 = Film(type=1, permalink='wrestler', imdb_code=120, status=1, version=1,
            release_year=2008, title='Wrestler', popularity=10, popularity_month=1)
        self.f10.save()

        self.f11 = Film(type=1, permalink='american-history-x', imdb_code=121, status=1, version=1,
            release_year=1998, title='American History X', popularity=1, popularity_month=1)
        self.f11.save()

        self.f12 = Film(type=1, permalink='the-big-lebowski', imdb_code=122, status=1, version=1,
            release_year=1998, title='The Big Lebowski', popularity=1, popularity_month=1)
        self.f12.save()

        self.f13 = Film(type=1, permalink='the-lord-of-the-rings-the-fellowship-of-the-ring', imdb_code=123, status=1, version=1,
            release_year=2001, title='The Lord of the Rings: The Fellowship of the Ring', popularity=1, popularity_month=1)
        self.f13.save()

        self.f14 = Film(type=1, permalink='raiders-of-the-lost-ark', imdb_code=124, status=1, version=1,
            release_year=1981, title='Raiders of the Lost Ark', popularity=1, popularity_month=1)
        self.f14.save()

        self.f15 = Film(type=1, permalink='the-alien', imdb_code=125, status=1, version=1,
            release_year=1979, title='The Alien', popularity=1, popularity_month=1)
        self.f15.save()

        self.f16 = Film(type=1, permalink='przypadek', imdb_code=126, status=1, version=1,
            release_year=1999, title='Przypadek', popularity=20, popularity_month=10)
        self.f16.save()

        self.f17 = Film(type=1, permalink='wrestler', imdb_code=127, status=1, version=1,
            release_year=2008, title='Wrestler', popularity=10, popularity_month=1)
        self.f17.save()

        self.f18 = Film(type=1, permalink='american-history-x', imdb_code=128, status=1, version=1,
            release_year=1998, title='American History X', popularity=1, popularity_month=1)
        self.f18.save()

        self.f19 = Film(type=1, permalink='the-big-lebowski', imdb_code=129, status=1, version=1,
            release_year=1998, title='The Big Lebowski', popularity=1, popularity_month=1)
        self.f19.save()

        self.f20 = Film(type=1, permalink='the-lord-of-the-rings-the-fellowship-of-the-ring', imdb_code=130, status=1, version=1,
            release_year=2001, title='The Lord of the Rings: The Fellowship of the Ring', popularity=1, popularity_month=1)
        self.f20.save()

        self.f21 = Film(type=1, permalink='raiders-of-the-lost-ark', imdb_code=131, status=1, version=1,
            release_year=1981, title='Raiders of the Lost Ark', popularity=1, popularity_month=1)
        self.f21.save()

        self.f22 = Film(type=1, permalink='the-alien', imdb_code=132, status=1, version=1,
            release_year=1979, title='The Alien', popularity=1, popularity_month=1)
        self.f22.save()

        self.f23 = Film(type=1, permalink='terminator-2-judgment-day', imdb_code=133, status=1, version=1,
        release_year=1991, title='Terminator 2: Judgment Day', popularity=1, popularity_month=1)
        self.f23.save()

        self.f24 = Film(type=1, permalink='przypadek', imdb_code=134, status=1, version=1,
            release_year=1999, title='Przypadek', popularity=20, popularity_month=10)
        self.f24.save()

        self.f25 = Film(type=1, permalink='wrestler', imdb_code=135, status=1, version=1,
            release_year=2008, title='Wrestler', popularity=10, popularity_month=1)
        self.f25.save()

        self.f26 = Film(type=1, permalink='american-history-x', imdb_code=136, status=1, version=1,
            release_year=1998, title='American History X', popularity=1, popularity_month=1)
        self.f26.save()

        self.f27 = Film(type=1, permalink='the-big-lebowski', imdb_code=137, status=1, version=1,
            release_year=1998, title='The Big Lebowski', popularity=1, popularity_month=1)
        self.f27.save()

        self.f28 = Film(type=1, permalink='the-lord-of-the-rings-the-fellowship-of-the-ring', imdb_code=138, status=1, version=1,
            release_year=2001, title='The Lord of the Rings: The Fellowship of the Ring', popularity=1, popularity_month=1)
        self.f28.save()

        self.f29 = Film(type=1, permalink='raiders-of-the-lost-ark', imdb_code=139, status=1, version=1,
            release_year=1981, title='Raiders of the Lost Ark', popularity=1, popularity_month=1)
        self.f29.save()

        self.f30 = Film(type=1, permalink='the-alien', imdb_code=140, status=1, version=1,
            release_year=1979, title='The Alien', popularity=1, popularity_month=1)
        self.f30.save()

        self.f1.save_tags('comedy drama horror animation mystery')
        self.f2.save_tags('comedy sci-fi thriller series')
        self.f3.save_tags('comedy')
        self.f4.save_tags('sci-fi')
        self.f5.save_tags('horror')
        self.f6.save_tags('thriller')
        self.f7.save_tags('drama')
        self.f8.save_tags('series')
        self.f9.save_tags('sci-fi')
        self.f10.save_tags('fantasy')
        self.f11.save_tags('mystery')
        self.f12.save_tags('action')
        self.f13.save_tags('adventure')
        self.f14.save_tags('animation')
        self.f15.save_tags('family')
        self.f16.save_tags('thriller')
        self.f17.save_tags('drama')
        self.f18.save_tags('series')
        self.f19.save_tags('sci-fi')
        self.f20.save_tags('fantasy')
        self.f21.save_tags('comedy')
        self.f22.save_tags('animation')
        self.f23.save_tags('comedy')
        self.f24.save_tags('sci-fi')
        self.f25.save_tags('horror')
        self.f26.save_tags('thriller')
        self.f27.save_tags('drama')
        self.f28.save_tags('series')
        self.f29.save_tags('sci-fi')
        self.f30.save_tags('fantasy')

        #First user ratings
        save_rating(self.f1, self.u1, 1)
        save_rating(self.f2, self.u1, 2)
        save_rating(self.f3, self.u1, 3)
        save_rating(self.f4, self.u1, 4)
        save_rating(self.f5, self.u1, 5)
        save_rating(self.f6, self.u1, 6)
        save_rating(self.f7, self.u1, 7)
        save_rating(self.f8, self.u1, 8)
        save_rating(self.f9, self.u1, 9)
        save_rating(self.f10, self.u1, 10)
        save_rating(self.f11, self.u1, 1)
        save_rating(self.f12, self.u1, 2)
        save_rating(self.f13, self.u1, 3)
        save_rating(self.f14, self.u1, 4)
        save_rating(self.f15, self.u1, 5)
        save_rating(self.f16, self.u1, 6)
        save_rating(self.f17, self.u1, 7)
        save_rating(self.f18, self.u1, 8)
        save_rating(self.f19, self.u1, 9)
        save_rating(self.f20, self.u1, 10)
        save_rating(self.f21, self.u1, 1)
        save_rating(self.f22, self.u1, 2)
        save_rating(self.f23, self.u1, 3)
        save_rating(self.f24, self.u1, 4)
        save_rating(self.f25, self.u1, 5)
        save_rating(self.f26, self.u1, 6)
        save_rating(self.f27, self.u1, 7)
        save_rating(self.f28, self.u1, 8)
        save_rating(self.f29, self.u1, 9)
        save_rating(self.f30, self.u1, 10)

        #Second user ratings - more than minimal common films requirement (15)
        save_rating(self.f1, self.u2, 1)
        save_rating(self.f2, self.u2, 2)
        save_rating(self.f3, self.u2, 3)
        save_rating(self.f4, self.u2, 4)
        save_rating(self.f5, self.u2, 5)
        save_rating(self.f6, self.u2, 6)
        save_rating(self.f7, self.u2, 7)
        save_rating(self.f8, self.u2, 8)
        save_rating(self.f9, self.u2, 9)
        save_rating(self.f10, self.u2, 10)
        save_rating(self.f11, self.u2, 1)
        #save_rating(self.f12, self.u2, 2)
        save_rating(self.f13, self.u2, 3)
        #save_rating(self.f14, self.u2, 4)
        save_rating(self.f15, self.u2, 5)
        #save_rating(self.f16, self.u2, 6)
        save_rating(self.f17, self.u2, 7)
        #save_rating(self.f18, self.u2, 8)
        save_rating(self.f19, self.u2, 9)
        #save_rating(self.f20, self.u2, 10)
        save_rating(self.f21, self.u2, 1)
        #save_rating(self.f22, self.u2, 2)
        save_rating(self.f23, self.u2, 3)
        #save_rating(self.f24, self.u2, 4)
        save_rating(self.f25, self.u2, 5)
        #save_rating(self.f26, self.u2, 6)
        save_rating(self.f27, self.u2, 7)
        #save_rating(self.f28, self.u2, 8)
        save_rating(self.f29, self.u2, 9)
        #save_rating(self.f30, self.u2, 10)

        # Third user ratings - equal with minimal common films requirement (15)
        #save_rating(self.f1, self.u3, 1)
        #save_rating(self.f2, self.u3, 2)
        #save_rating(self.f3, self.u3, 3)
        #save_rating(self.f4, self.u3, 4)
        #save_rating(self.f5, self.u3, 5)
        #save_rating(self.f6, self.u3, 6)
        #save_rating(self.f7, self.u3, 7)
        #save_rating(self.f8, self.u3, 8)
        #save_rating(self.f9, self.u3, 9)
        #save_rating(self.f10, self.u3, 10)
        #save_rating(self.f11, self.u3, 1)
        #save_rating(self.f12, self.u3, 2)
        #save_rating(self.f13, self.u3, 3)
        #save_rating(self.f14, self.u3, 4)
        #save_rating(self.f15, self.u3, 5)
        save_rating(self.f16, self.u3, 6)
        save_rating(self.f17, self.u3, 7)
        save_rating(self.f18, self.u3, 8)
        save_rating(self.f19, self.u3, 9)
        save_rating(self.f20, self.u3, 10)
        save_rating(self.f21, self.u3, 1)
        save_rating(self.f22, self.u3, 2)
        save_rating(self.f23, self.u3, 3)
        save_rating(self.f24, self.u3, 4)
        save_rating(self.f25, self.u3, 5)
        save_rating(self.f26, self.u3, 6)
        save_rating(self.f27, self.u3, 7)
        save_rating(self.f28, self.u3, 8)
        save_rating(self.f29, self.u3, 9)
        save_rating(self.f30, self.u3, 10)

        # Fourth user ratings - less than minimal films requirement
        #save_rating(self.f1, self.u4, 1)
        #save_rating(self.f2, self.u4, 2)
        #save_rating(self.f3, self.u4, 3)
        #save_rating(self.f4, self.u4, 4)
        #save_rating(self.f5, self.u4, 5)
        #save_rating(self.f6, self.u4, 6)
        #save_rating(self.f7, self.u4, 7)
        #save_rating(self.f8, self.u4, 8)
        #save_rating(self.f9, self.u4, 9)
        #save_rating(self.f10, self.u4, 10)
        #save_rating(self.f11, self.u4, 1)
        #save_rating(self.f12, self.u4, 2)
        #save_rating(self.f13, self.u4, 3)
        #save_rating(self.f14, self.u4, 4)
        #save_rating(self.f15, self.u4, 5)
        #save_rating(self.f16, self.u4, 6)
        #save_rating(self.f17, self.u4, 7)
        #save_rating(self.f18, self.u4, 8)
        #save_rating(self.f19, self.u4, 9)
        #save_rating(self.f20, self.u4, 10)
        save_rating(self.f21, self.u4, 1)
        save_rating(self.f22, self.u4, 2)
        save_rating(self.f23, self.u4, 3)
        save_rating(self.f24, self.u4, 4)
        save_rating(self.f25, self.u4, 5)
        save_rating(self.f26, self.u4, 6)
        save_rating(self.f27, self.u4, 7)
        save_rating(self.f28, self.u4, 8)
        save_rating(self.f29, self.u4, 9)
        save_rating(self.f30, self.u4, 10)
Пример #7
0
    def setUp(self):
        User.objects.all().delete()

        Object.objects.all().delete()
        Film.objects.all().delete()
        FilmLog.objects.all().delete()
        Rating.objects.all().delete()
        Recommendation.objects.all().delete()
        Person.objects.all().delete()

        AddedCharacter.objects.all().delete()
        AddedFilm.objects.all().delete()

        # set up users
        self.u1 = User(username='******', email='*****@*****.**')
        self.u1.save()

        self.u2 = User.objects.create_user("root", "*****@*****.**", "root")
        self.u2.user_permissions.add(
            Permission.objects.get(codename="can_accept_added_films"))
        self.u2.save()

        self.u3 = User(username='******', email='*****@*****.**')
        self.u3.save()

        self.u4 = User(username='******', email='*****@*****.**')
        self.u4.save()

        self.u5 = User(username='******', email='*****@*****.**')
        self.u5.save()

        self.u6 = User(username='******', email='*****@*****.**')
        self.u6.save()

        # some persons
        self.p1 = Person(name="Clint",
                         surname="Eastwood",
                         imdb_code=None,
                         type=Person.TYPE_PERSON)
        self.p1.save()

        self.p2 = Person(name="Sylvester",
                         surname="Stallone",
                         imdb_code=None,
                         type=Person.TYPE_PERSON)
        self.p2.save()

        self.p3 = Person(name="Jack",
                         surname="Mort",
                         imdb_code=None,
                         type=Person.TYPE_PERSON)
        self.p3.save()

        # set up films
        self.f1 = Film(type=1,
                       permalink='przypadek',
                       imdb_code=111,
                       status=1,
                       version=1,
                       release_year=1999,
                       title='Przypadek',
                       popularity=20,
                       popularity_month=10)
        self.f1.save()

        self.f2 = Film(type=1,
                       permalink='wrestler',
                       imdb_code=112,
                       status=1,
                       version=1,
                       release_year=2008,
                       title='Wrestler',
                       popularity=10,
                       popularity_month=1)
        self.f2.save()

        self.f3 = Film(type=1,
                       permalink='american-history-x',
                       imdb_code=113,
                       status=1,
                       version=1,
                       release_year=1998,
                       title='American History X',
                       popularity=1,
                       popularity_month=1)
        self.f3.save()

        self.f4 = Film(type=1,
                       permalink='the-big-lebowski',
                       imdb_code=114,
                       status=1,
                       version=1,
                       release_year=1998,
                       title='The Big Lebowski',
                       popularity=1,
                       popularity_month=1)
        self.f4.save()

        self.f5 = Film(
            type=1,
            permalink='the-lord-of-the-rings-the-fellowship-of-the-ring',
            imdb_code=115,
            status=1,
            version=1,
            release_year=2001,
            title='The Lord of the Rings: The Fellowship of the Ring',
            popularity=1,
            popularity_month=1)
        self.f5.save()

        self.f6 = Film(type=1,
                       permalink='raiders-of-the-lost-ark',
                       imdb_code=116,
                       status=1,
                       version=1,
                       release_year=1981,
                       title='Raiders of the Lost Ark',
                       popularity=1,
                       popularity_month=1)
        self.f6.save()

        self.f7 = Film(type=1,
                       permalink='the-alien',
                       imdb_code=117,
                       status=1,
                       version=1,
                       release_year=1979,
                       title='The Alien',
                       popularity=1,
                       popularity_month=1)
        self.f7.save()

        self.f8 = Film(type=1,
                       permalink='terminator-2-judgment-day',
                       imdb_code=118,
                       status=1,
                       version=1,
                       release_year=1991,
                       title='Terminator 2: Judgment Day',
                       popularity=1,
                       popularity_month=1)
        self.f8.save()

        self.f9 = Film(type=1,
                       permalink='przypadek',
                       imdb_code=119,
                       status=1,
                       version=1,
                       release_year=1999,
                       title='Przypadek',
                       popularity=20,
                       popularity_month=10)
        self.f9.save()

        self.f10 = Film(type=1,
                        permalink='wrestler',
                        imdb_code=120,
                        status=1,
                        version=1,
                        release_year=2008,
                        title='Wrestler',
                        popularity=10,
                        popularity_month=1)
        self.f10.save()

        self.f11 = Film(type=1,
                        permalink='american-history-x',
                        imdb_code=121,
                        status=1,
                        version=1,
                        release_year=1998,
                        title='American History X',
                        popularity=1,
                        popularity_month=1)
        self.f11.save()

        self.f12 = Film(type=1,
                        permalink='the-big-lebowski',
                        imdb_code=122,
                        status=1,
                        version=1,
                        release_year=1998,
                        title='The Big Lebowski',
                        popularity=1,
                        popularity_month=1)
        self.f12.save()

        self.f13 = Film(
            type=1,
            permalink='the-lord-of-the-rings-the-fellowship-of-the-ring',
            imdb_code=123,
            status=1,
            version=1,
            release_year=2001,
            title='The Lord of the Rings: The Fellowship of the Ring',
            popularity=1,
            popularity_month=1)
        self.f13.save()

        self.f14 = Film(type=1,
                        permalink='raiders-of-the-lost-ark',
                        imdb_code=124,
                        status=1,
                        version=1,
                        release_year=1981,
                        title='Raiders of the Lost Ark',
                        popularity=1,
                        popularity_month=1)
        self.f14.save()

        self.f15 = Film(type=1,
                        permalink='the-alien',
                        imdb_code=125,
                        status=1,
                        version=1,
                        release_year=1979,
                        title='The Alien',
                        popularity=1,
                        popularity_month=1)
        self.f15.save()

        self.f16 = Film(type=1,
                        permalink='przypadek',
                        imdb_code=126,
                        status=1,
                        version=1,
                        release_year=1999,
                        title='Przypadek',
                        popularity=20,
                        popularity_month=10)
        self.f16.save()

        self.f17 = Film(type=1,
                        permalink='wrestler',
                        imdb_code=127,
                        status=1,
                        version=1,
                        release_year=2008,
                        title='Wrestler',
                        popularity=10,
                        popularity_month=1)
        self.f17.save()

        self.f18 = Film(type=1,
                        permalink='american-history-x',
                        imdb_code=128,
                        status=1,
                        version=1,
                        release_year=1998,
                        title='American History X',
                        popularity=1,
                        popularity_month=1)
        self.f18.save()

        self.f19 = Film(type=1,
                        permalink='the-big-lebowski',
                        imdb_code=129,
                        status=1,
                        version=1,
                        release_year=1998,
                        title='The Big Lebowski',
                        popularity=1,
                        popularity_month=1)
        self.f19.save()

        self.f20 = Film(
            type=1,
            permalink='the-lord-of-the-rings-the-fellowship-of-the-ring',
            imdb_code=130,
            status=1,
            version=1,
            release_year=2001,
            title='The Lord of the Rings: The Fellowship of the Ring',
            popularity=1,
            popularity_month=1)
        self.f20.save()

        self.f21 = Film(type=1,
                        permalink='raiders-of-the-lost-ark',
                        imdb_code=131,
                        status=1,
                        version=1,
                        release_year=1981,
                        title='Raiders of the Lost Ark',
                        popularity=1,
                        popularity_month=1)
        self.f21.save()

        self.f22 = Film(type=1,
                        permalink='the-alien',
                        imdb_code=132,
                        status=1,
                        version=1,
                        release_year=1979,
                        title='The Alien',
                        popularity=1,
                        popularity_month=1)
        self.f22.save()

        self.f23 = Film(type=1,
                        permalink='terminator-2-judgment-day',
                        imdb_code=133,
                        status=1,
                        version=1,
                        release_year=1991,
                        title='Terminator 2: Judgment Day',
                        popularity=1,
                        popularity_month=1)
        self.f23.save()

        self.f24 = Film(type=1,
                        permalink='przypadek',
                        imdb_code=134,
                        status=1,
                        version=1,
                        release_year=1999,
                        title='Przypadek',
                        popularity=20,
                        popularity_month=10)
        self.f24.save()

        self.f25 = Film(type=1,
                        permalink='wrestler',
                        imdb_code=135,
                        status=1,
                        version=1,
                        release_year=2008,
                        title='Wrestler',
                        popularity=10,
                        popularity_month=1)
        self.f25.save()

        self.f26 = Film(type=1,
                        permalink='american-history-x',
                        imdb_code=136,
                        status=1,
                        version=1,
                        release_year=1998,
                        title='American History X',
                        popularity=1,
                        popularity_month=1)
        self.f26.save()

        self.f27 = Film(type=1,
                        permalink='the-big-lebowski',
                        imdb_code=137,
                        status=1,
                        version=1,
                        release_year=1998,
                        title='The Big Lebowski',
                        popularity=1,
                        popularity_month=1)
        self.f27.save()

        self.f28 = Film(
            type=1,
            permalink='the-lord-of-the-rings-the-fellowship-of-the-ring',
            imdb_code=138,
            status=1,
            version=1,
            release_year=2001,
            title='The Lord of the Rings: The Fellowship of the Ring',
            popularity=1,
            popularity_month=1)
        self.f28.save()

        self.f29 = Film(type=1,
                        permalink='raiders-of-the-lost-ark',
                        imdb_code=139,
                        status=1,
                        version=1,
                        release_year=1981,
                        title='Raiders of the Lost Ark',
                        popularity=1,
                        popularity_month=1)
        self.f29.save()

        self.f30 = Film(type=1,
                        permalink='the-alien',
                        imdb_code=140,
                        status=1,
                        version=1,
                        release_year=1979,
                        title='The Alien',
                        popularity=1,
                        popularity_month=1)
        self.f30.save()

        self.f31 = AddedFilm(title='Added film part 1',
                             localized_title='Added film PL',
                             release_year=2010,
                             user=self.u1)
        self.f31.save()

        self.f31.directors.add(self.p1)
        self.f31.save()

        AddedCharacter.objects.create(added_film=self.f31,
                                      person=self.p3,
                                      character="Jack Mort")

        self.f31.accept(self.u2)

        self.f32 = AddedFilm(title='Added film part 2',
                             localized_title='Added film PL',
                             release_year=2010,
                             user=self.u1)
        self.f32.save()

        self.f32.directors.add(self.p2)
        self.f32.save()

        AddedCharacter.objects.create(added_film=self.f32,
                                      person=self.p3,
                                      character="Jack Mort")

        self.f32.accept(self.u2)

        #tagging
        self.f1.save_tags('comedy drama horror animation mystery')
        self.f2.save_tags('comedy sci-fi thriller series')
        self.f3.save_tags('comedy')
        self.f4.save_tags('sci-fi')
        self.f5.save_tags('horror')
        self.f6.save_tags('thriller')
        self.f7.save_tags('drama')
        self.f8.save_tags('series')
        self.f9.save_tags('sci-fi')
        self.f10.save_tags('fantasy')
        self.f11.save_tags('mystery')
        self.f12.save_tags('action')
        self.f13.save_tags('adventure')
        self.f14.save_tags('animation')
        self.f15.save_tags('family')
        self.f16.save_tags('thriller')
        self.f17.save_tags('drama')
        self.f18.save_tags('series')
        self.f19.save_tags('sci-fi')
        self.f20.save_tags('fantasy')
        self.f21.save_tags('comedy')
        self.f22.save_tags('animation')
        self.f23.save_tags('comedy')
        self.f24.save_tags('sci-fi')
        self.f25.save_tags('horror')
        self.f26.save_tags('thriller')
        self.f27.save_tags('drama')
        self.f28.save_tags('series')
        self.f29.save_tags('sci-fi')
        self.f30.save_tags('fantasy')

        #First user ratings
        save_rating(self.f1, self.u1, 1)
        save_rating(self.f2, self.u1, 2)
        save_rating(self.f3, self.u1, 3)
        save_rating(self.f4, self.u1, 4)
        save_rating(self.f5, self.u1, 5)
        save_rating(self.f6, self.u1, 6)
        save_rating(self.f7, self.u1, 7)
        save_rating(self.f8, self.u1, 8)
        save_rating(self.f9, self.u1, 9)
        save_rating(self.f10, self.u1, 10)
        save_rating(self.f11, self.u1, 1)
        save_rating(self.f12, self.u1, 2)
        save_rating(self.f13, self.u1, 3)
        save_rating(self.f14, self.u1, 4)
        save_rating(self.f15, self.u1, 5)
        save_rating(self.f16, self.u1, 6)
        save_rating(self.f17, self.u1, 7)
        save_rating(self.f18, self.u1, 8)
        save_rating(self.f19, self.u1, 9)
        save_rating(self.f20, self.u1, 10)
        save_rating(self.f21, self.u1, 1)
        save_rating(self.f22, self.u1, 2)
        save_rating(self.f23, self.u1, 3)
        save_rating(self.f24, self.u1, 4)
        save_rating(self.f25, self.u1, 5)
        save_rating(self.f26, self.u1, 6)
        save_rating(self.f27, self.u1, 7)
        save_rating(self.f28, self.u1, 8)
        save_rating(self.f29, self.u1, 9)
        save_rating(self.f30, self.u1, 10)

        #Second user ratings - more than minimal common films requirement (15)
        save_rating(self.f1, self.u2, 1)
        save_rating(self.f2, self.u2, 2)
        save_rating(self.f3, self.u2, 3)
        save_rating(self.f4, self.u2, 4)
        save_rating(self.f5, self.u2, 5)
        save_rating(self.f6, self.u2, 6)
        save_rating(self.f7, self.u2, 7)
        save_rating(self.f8, self.u2, 8)
        save_rating(self.f9, self.u2, 9)
        save_rating(self.f10, self.u2, 10)
        save_rating(self.f11, self.u2, 1)
        #save_rating(self.f12, self.u2, 2)
        save_rating(self.f13, self.u2, 3)
        #save_rating(self.f14, self.u2, 4)
        save_rating(self.f15, self.u2, 5)
        #save_rating(self.f16, self.u2, 6)
        save_rating(self.f17, self.u2, 7)
        #save_rating(self.f18, self.u2, 8)
        save_rating(self.f19, self.u2, 9)
        #save_rating(self.f20, self.u2, 10)
        save_rating(self.f21, self.u2, 1)
        #save_rating(self.f22, self.u2, 2)
        save_rating(self.f23, self.u2, 3)
        #save_rating(self.f24, self.u2, 4)
        save_rating(self.f25, self.u2, 5)
        #save_rating(self.f26, self.u2, 6)
        save_rating(self.f27, self.u2, 7)
        #save_rating(self.f28, self.u2, 8)
        save_rating(self.f29, self.u2, 9)
        #save_rating(self.f30, self.u2, 10)

        # Third user ratings - equal with minimal common films requirement (15)
        #save_rating(self.f1, self.u3, 1)
        #save_rating(self.f2, self.u3, 2)
        #save_rating(self.f3, self.u3, 3)
        #save_rating(self.f4, self.u3, 4)
        #save_rating(self.f5, self.u3, 5)
        #save_rating(self.f6, self.u3, 6)
        #save_rating(self.f7, self.u3, 7)
        #save_rating(self.f8, self.u3, 8)
        #save_rating(self.f9, self.u3, 9)
        #save_rating(self.f10, self.u3, 10)
        #save_rating(self.f11, self.u3, 1)
        #save_rating(self.f12, self.u3, 2)
        #save_rating(self.f13, self.u3, 3)
        #save_rating(self.f14, self.u3, 4)
        #save_rating(self.f15, self.u3, 5)
        save_rating(self.f16, self.u3, 6)
        save_rating(self.f17, self.u3, 7)
        save_rating(self.f18, self.u3, 8)
        save_rating(self.f19, self.u3, 9)
        save_rating(self.f20, self.u3, 10)
        save_rating(self.f21, self.u3, 1)
        save_rating(self.f22, self.u3, 2)
        save_rating(self.f23, self.u3, 3)
        save_rating(self.f24, self.u3, 4)
        save_rating(self.f25, self.u3, 5)
        save_rating(self.f26, self.u3, 6)
        save_rating(self.f27, self.u3, 7)
        save_rating(self.f28, self.u3, 8)
        save_rating(self.f29, self.u3, 9)
        save_rating(self.f30, self.u3, 10)

        # Fourth user ratings - less than minimal films requirement
        #save_rating(self.f1, self.u4, 1)
        #save_rating(self.f2, self.u4, 2)
        #save_rating(self.f3, self.u4, 3)
        #save_rating(self.f4, self.u4, 4)
        #save_rating(self.f5, self.u4, 5)
        #save_rating(self.f6, self.u4, 6)
        #save_rating(self.f7, self.u4, 7)
        #save_rating(self.f8, self.u4, 8)
        #save_rating(self.f9, self.u4, 9)
        #save_rating(self.f10, self.u4, 10)
        #save_rating(self.f11, self.u4, 1)
        #save_rating(self.f12, self.u4, 2)
        #save_rating(self.f13, self.u4, 3)
        #save_rating(self.f14, self.u4, 4)
        #save_rating(self.f15, self.u4, 5)
        #save_rating(self.f16, self.u4, 6)
        #save_rating(self.f17, self.u4, 7)
        #save_rating(self.f18, self.u4, 8)
        #save_rating(self.f19, self.u4, 9)
        #save_rating(self.f20, self.u4, 10)
        save_rating(self.f21, self.u4, 1)
        save_rating(self.f22, self.u4, 2)
        save_rating(self.f23, self.u4, 3)
        save_rating(self.f24, self.u4, 4)
        save_rating(self.f25, self.u4, 5)
        save_rating(self.f26, self.u4, 6)
        save_rating(self.f27, self.u4, 7)
        save_rating(self.f28, self.u4, 8)
        save_rating(self.f29, self.u4, 9)
        save_rating(self.f30, self.u4, 10)

        # Fifth user ratings - the same films rated (1st and 5th user) but different
        # ratings
        #save_rating(self.f1, self.u5, 10)
        #save_rating(self.f2, self.u5, 9)
        #save_rating(self.f3, self.u5, 8)
        #save_rating(self.f4, self.u5, 7)
        #save_rating(self.f5, self.u5, 6)
        #save_rating(self.f6, self.u5, 5)
        #save_rating(self.f7, self.u5, 4)
        #save_rating(self.f8, self.u5, 3)
        #save_rating(self.f9, self.u5, 2)
        #save_rating(self.f10, self.u5, 1)
        #save_rating(self.f11, self.u5, 10)
        #save_rating(self.f12, self.u5, 9)
        #save_rating(self.f13, self.u5, 8)
        #save_rating(self.f14, self.u5, 7)
        #save_rating(self.f15, self.u5, 6)
        #save_rating(self.f16, self.u5, 5)
        #save_rating(self.f17, self.u5, 4)
        #save_rating(self.f18, self.u5, 3)
        #save_rating(self.f19, self.u5, 2)
        #save_rating(self.f20, self.u5, 1)
        #save_rating(self.f21, self.u5, 10)
        #save_rating(self.f22, self.u5, 9)
        #save_rating(self.f23, self.u5, 8)
        #save_rating(self.f24, self.u5, 7)
        #save_rating(self.f25, self.u5, 6)
        #save_rating(self.f26, self.u5, 5)
        #save_rating(self.f27, self.u5, 4)
        #save_rating(self.f28, self.u5, 3)
        #save_rating(self.f29, self.u5, 2)
        #save_rating(self.f30, self.u5, 1)

        # Sixth user ratings - the same films rated (1st and 5th user) but different
        # ratings
        save_rating(self.f1, self.u6, 10)
        save_rating(self.f2, self.u6, 10)
        save_rating(self.f3, self.u6, 10)
        save_rating(self.f4, self.u6, 10)
        save_rating(self.f5, self.u6, 10)
        save_rating(self.f6, self.u6, 10)
        save_rating(self.f7, self.u6, 10)
        save_rating(self.f8, self.u6, 10)
        save_rating(self.f9, self.u6, 10)
        save_rating(self.f10, self.u6, 10)
        save_rating(self.f11, self.u6, 10)
        save_rating(self.f12, self.u6, 10)
        save_rating(self.f13, self.u6, 10)
        save_rating(self.f14, self.u6, 10)
        save_rating(self.f15, self.u6, 10)
        save_rating(self.f16, self.u6, 10)
        save_rating(self.f17, self.u6, 10)
        save_rating(self.f18, self.u6, 10)
        save_rating(self.f19, self.u6, 10)
        save_rating(self.f20, self.u6, 10)
        save_rating(self.f21, self.u6, 10)
        save_rating(self.f22, self.u6, 10)
        save_rating(self.f23, self.u6, 10)
        save_rating(self.f24, self.u6, 10)
        save_rating(self.f25, self.u6, 10)
        save_rating(self.f26, self.u6, 10)
        save_rating(self.f27, self.u6, 10)
        save_rating(self.f28, self.u6, 10)
        save_rating(self.f29, self.u6, 10)
        save_rating(self.f30, self.u6, 10)
Пример #8
0
    def films_for_comparator(self):
        # films for comnparator
        self.f1 = Film(type=1,
                       permalink='przypadek',
                       imdb_code=111,
                       status=1,
                       version=1,
                       release_year=1999,
                       title='Przypadek',
                       popularity=20,
                       popularity_month=10)
        self.f1.save()

        self.f2 = Film(type=1,
                       permalink='wrestler',
                       imdb_code=112,
                       status=1,
                       version=1,
                       release_year=2008,
                       title='Wrestler',
                       popularity=10,
                       popularity_month=1)
        self.f2.save()

        self.f3 = Film(type=1,
                       permalink='american-history-x',
                       imdb_code=113,
                       status=1,
                       version=1,
                       release_year=1998,
                       title='American History X',
                       popularity=1,
                       popularity_month=1)
        self.f3.save()

        self.f4 = Film(type=1,
                       permalink='the-big-lebowski',
                       imdb_code=114,
                       status=1,
                       version=1,
                       release_year=1998,
                       title='The Big Lebowski',
                       popularity=1,
                       popularity_month=1)
        self.f4.save()

        self.f5 = Film(
            type=1,
            permalink='the-lord-of-the-rings-the-fellowship-of-the-ring',
            imdb_code=115,
            status=1,
            version=1,
            release_year=2001,
            title='The Lord of the Rings: The Fellowship of the Ring',
            popularity=1,
            popularity_month=1)
        self.f5.save()

        self.f6 = Film(type=1,
                       permalink='raiders-of-the-lost-ark',
                       imdb_code=116,
                       status=1,
                       version=1,
                       release_year=1981,
                       title='Raiders of the Lost Ark',
                       popularity=1,
                       popularity_month=1)
        self.f6.save()

        self.f7 = Film(type=1,
                       permalink='the-alien',
                       imdb_code=117,
                       status=1,
                       version=1,
                       release_year=1979,
                       title='The Alien',
                       popularity=1,
                       popularity_month=1)
        self.f7.save()

        self.f8 = Film(type=1,
                       permalink='terminator-2-judgment-day',
                       imdb_code=118,
                       status=1,
                       version=1,
                       release_year=1991,
                       title='Terminator 2: Judgment Day',
                       popularity=1,
                       popularity_month=1)
        self.f8.save()

        self.f9 = Film(type=1,
                       permalink='przypadek',
                       imdb_code=119,
                       status=1,
                       version=1,
                       release_year=1999,
                       title='Przypadek',
                       popularity=20,
                       popularity_month=10)
        self.f9.save()

        self.f10 = Film(type=1,
                        permalink='wrestler',
                        imdb_code=120,
                        status=1,
                        version=1,
                        release_year=2008,
                        title='Wrestler',
                        popularity=10,
                        popularity_month=1)
        self.f10.save()

        self.f11 = Film(type=1,
                        permalink='american-history-x',
                        imdb_code=121,
                        status=1,
                        version=1,
                        release_year=1998,
                        title='American History X',
                        popularity=1,
                        popularity_month=1)
        self.f11.save()

        self.f12 = Film(type=1,
                        permalink='the-big-lebowski',
                        imdb_code=122,
                        status=1,
                        version=1,
                        release_year=1998,
                        title='The Big Lebowski',
                        popularity=1,
                        popularity_month=1)
        self.f12.save()

        self.f13 = Film(
            type=1,
            permalink='the-lord-of-the-rings-the-fellowship-of-the-ring',
            imdb_code=123,
            status=1,
            version=1,
            release_year=2001,
            title='The Lord of the Rings: The Fellowship of the Ring',
            popularity=1,
            popularity_month=1)
        self.f13.save()

        self.f14 = Film(type=1,
                        permalink='raiders-of-the-lost-ark',
                        imdb_code=124,
                        status=1,
                        version=1,
                        release_year=1981,
                        title='Raiders of the Lost Ark',
                        popularity=1,
                        popularity_month=1)
        self.f14.save()

        self.f15 = Film(type=1,
                        permalink='the-alien',
                        imdb_code=125,
                        status=1,
                        version=1,
                        release_year=1979,
                        title='The Alien',
                        popularity=1,
                        popularity_month=1)
        self.f15.save()

        self.f16 = Film(type=1,
                        permalink='przypadek',
                        imdb_code=126,
                        status=1,
                        version=1,
                        release_year=1999,
                        title='Przypadek',
                        popularity=20,
                        popularity_month=10)
        self.f16.save()

        self.f17 = Film(type=1,
                        permalink='wrestler',
                        imdb_code=127,
                        status=1,
                        version=1,
                        release_year=2008,
                        title='Wrestler',
                        popularity=10,
                        popularity_month=1)
        self.f17.save()

        self.f18 = Film(type=1,
                        permalink='american-history-x',
                        imdb_code=128,
                        status=1,
                        version=1,
                        release_year=1998,
                        title='American History X',
                        popularity=1,
                        popularity_month=1)
        self.f18.save()

        self.f19 = Film(type=1,
                        permalink='the-big-lebowski',
                        imdb_code=129,
                        status=1,
                        version=1,
                        release_year=1998,
                        title='The Big Lebowski',
                        popularity=1,
                        popularity_month=1)
        self.f19.save()

        self.f20 = Film(
            type=1,
            permalink='the-lord-of-the-rings-the-fellowship-of-the-ring',
            imdb_code=130,
            status=1,
            version=1,
            release_year=2001,
            title='The Lord of the Rings: The Fellowship of the Ring',
            popularity=1,
            popularity_month=1)
        self.f20.save()

        self.f21 = Film(type=1,
                        permalink='raiders-of-the-lost-ark',
                        imdb_code=131,
                        status=1,
                        version=1,
                        release_year=1981,
                        title='Raiders of the Lost Ark',
                        popularity=1,
                        popularity_month=1)
        self.f21.save()

        self.f22 = Film(type=1,
                        permalink='the-alien',
                        imdb_code=132,
                        status=1,
                        version=1,
                        release_year=1979,
                        title='The Alien',
                        popularity=1,
                        popularity_month=1)
        self.f22.save()

        self.f23 = Film(type=1,
                        permalink='terminator-2-judgment-day',
                        imdb_code=133,
                        status=1,
                        version=1,
                        release_year=1991,
                        title='Terminator 2: Judgment Day',
                        popularity=1,
                        popularity_month=1)
        self.f23.save()

        self.f24 = Film(type=1,
                        permalink='przypadek',
                        imdb_code=134,
                        status=1,
                        version=1,
                        release_year=1999,
                        title='Przypadek',
                        popularity=20,
                        popularity_month=10)
        self.f24.save()

        self.f25 = Film(type=1,
                        permalink='wrestler',
                        imdb_code=135,
                        status=1,
                        version=1,
                        release_year=2008,
                        title='Wrestler',
                        popularity=10,
                        popularity_month=1)
        self.f25.save()

        self.f26 = Film(type=1,
                        permalink='american-history-x',
                        imdb_code=136,
                        status=1,
                        version=1,
                        release_year=1998,
                        title='American History X',
                        popularity=1,
                        popularity_month=1)
        self.f26.save()

        self.f27 = Film(type=1,
                        permalink='the-big-lebowski',
                        imdb_code=137,
                        status=1,
                        version=1,
                        release_year=1998,
                        title='The Big Lebowski',
                        popularity=1,
                        popularity_month=1)
        self.f27.save()

        self.f28 = Film(
            type=1,
            permalink='the-lord-of-the-rings-the-fellowship-of-the-ring',
            imdb_code=138,
            status=1,
            version=1,
            release_year=2001,
            title='The Lord of the Rings: The Fellowship of the Ring',
            popularity=1,
            popularity_month=1)
        self.f28.save()

        self.f29 = Film(type=1,
                        permalink='raiders-of-the-lost-ark',
                        imdb_code=139,
                        status=1,
                        version=1,
                        release_year=1981,
                        title='Raiders of the Lost Ark',
                        popularity=1,
                        popularity_month=1)
        self.f29.save()

        self.f30 = Film(type=1,
                        permalink='the-alien',
                        imdb_code=140,
                        status=1,
                        version=1,
                        release_year=1979,
                        title='The Alien',
                        popularity=1,
                        popularity_month=1)
        self.f30.save()

        self.f1.save_tags('comedy drama horror animation mystery')
        self.f2.save_tags('comedy sci-fi thriller series')
        self.f3.save_tags('comedy')
        self.f4.save_tags('sci-fi')
        self.f5.save_tags('horror')
        self.f6.save_tags('thriller')
        self.f7.save_tags('drama')
        self.f8.save_tags('series')
        self.f9.save_tags('sci-fi')
        self.f10.save_tags('fantasy')
        self.f11.save_tags('mystery')
        self.f12.save_tags('action')
        self.f13.save_tags('adventure')
        self.f14.save_tags('animation')
        self.f15.save_tags('family')
        self.f16.save_tags('thriller')
        self.f17.save_tags('drama')
        self.f18.save_tags('series')
        self.f19.save_tags('sci-fi')
        self.f20.save_tags('fantasy')
        self.f21.save_tags('comedy')
        self.f22.save_tags('animation')
        self.f23.save_tags('comedy')
        self.f24.save_tags('sci-fi')
        self.f25.save_tags('horror')
        self.f26.save_tags('thriller')
        self.f27.save_tags('drama')
        self.f28.save_tags('series')
        self.f29.save_tags('sci-fi')
        self.f30.save_tags('fantasy')

        #First user ratings
        save_rating(self.f1, self.u1, 1)
        save_rating(self.f2, self.u1, 2)
        save_rating(self.f3, self.u1, 3)
        save_rating(self.f4, self.u1, 4)
        save_rating(self.f5, self.u1, 5)
        save_rating(self.f6, self.u1, 6)
        save_rating(self.f7, self.u1, 7)
        save_rating(self.f8, self.u1, 8)
        save_rating(self.f9, self.u1, 9)
        save_rating(self.f10, self.u1, 10)
        save_rating(self.f11, self.u1, 1)
        save_rating(self.f12, self.u1, 2)
        save_rating(self.f13, self.u1, 3)
        save_rating(self.f14, self.u1, 4)
        save_rating(self.f15, self.u1, 5)
        save_rating(self.f16, self.u1, 6)
        save_rating(self.f17, self.u1, 7)
        save_rating(self.f18, self.u1, 8)
        save_rating(self.f19, self.u1, 9)
        save_rating(self.f20, self.u1, 10)
        save_rating(self.f21, self.u1, 1)
        save_rating(self.f22, self.u1, 2)
        save_rating(self.f23, self.u1, 3)
        save_rating(self.f24, self.u1, 4)
        save_rating(self.f25, self.u1, 5)
        save_rating(self.f26, self.u1, 6)
        save_rating(self.f27, self.u1, 7)
        save_rating(self.f28, self.u1, 8)
        save_rating(self.f29, self.u1, 9)
        save_rating(self.f30, self.u1, 10)

        #Second user ratings - more than minimal common films requirement (15)
        save_rating(self.f1, self.u2, 1)
        save_rating(self.f2, self.u2, 2)
        save_rating(self.f3, self.u2, 3)
        save_rating(self.f4, self.u2, 4)
        save_rating(self.f5, self.u2, 5)
        save_rating(self.f6, self.u2, 6)
        save_rating(self.f7, self.u2, 7)
        save_rating(self.f8, self.u2, 8)
        save_rating(self.f9, self.u2, 9)
        save_rating(self.f10, self.u2, 10)
        save_rating(self.f11, self.u2, 1)
        #save_rating(self.f12, self.u2, 2)
        save_rating(self.f13, self.u2, 3)
        #save_rating(self.f14, self.u2, 4)
        save_rating(self.f15, self.u2, 5)
        #save_rating(self.f16, self.u2, 6)
        save_rating(self.f17, self.u2, 7)
        #save_rating(self.f18, self.u2, 8)
        save_rating(self.f19, self.u2, 9)
        #save_rating(self.f20, self.u2, 10)
        save_rating(self.f21, self.u2, 1)
        #save_rating(self.f22, self.u2, 2)
        save_rating(self.f23, self.u2, 3)
        #save_rating(self.f24, self.u2, 4)
        save_rating(self.f25, self.u2, 5)
        #save_rating(self.f26, self.u2, 6)
        save_rating(self.f27, self.u2, 7)
        #save_rating(self.f28, self.u2, 8)
        save_rating(self.f29, self.u2, 9)
        #save_rating(self.f30, self.u2, 10)

        # Third user ratings - equal with minimal common films requirement (15)
        #save_rating(self.f1, self.u3, 1)
        #save_rating(self.f2, self.u3, 2)
        #save_rating(self.f3, self.u3, 3)
        #save_rating(self.f4, self.u3, 4)
        #save_rating(self.f5, self.u3, 5)
        #save_rating(self.f6, self.u3, 6)
        #save_rating(self.f7, self.u3, 7)
        #save_rating(self.f8, self.u3, 8)
        #save_rating(self.f9, self.u3, 9)
        #save_rating(self.f10, self.u3, 10)
        #save_rating(self.f11, self.u3, 1)
        #save_rating(self.f12, self.u3, 2)
        #save_rating(self.f13, self.u3, 3)
        #save_rating(self.f14, self.u3, 4)
        #save_rating(self.f15, self.u3, 5)
        save_rating(self.f16, self.u3, 6)
        save_rating(self.f17, self.u3, 7)
        save_rating(self.f18, self.u3, 8)
        save_rating(self.f19, self.u3, 9)
        save_rating(self.f20, self.u3, 10)
        save_rating(self.f21, self.u3, 1)
        save_rating(self.f22, self.u3, 2)
        save_rating(self.f23, self.u3, 3)
        save_rating(self.f24, self.u3, 4)
        save_rating(self.f25, self.u3, 5)
        save_rating(self.f26, self.u3, 6)
        save_rating(self.f27, self.u3, 7)
        save_rating(self.f28, self.u3, 8)
        save_rating(self.f29, self.u3, 9)
        save_rating(self.f30, self.u3, 10)

        # Fourth user ratings - less than minimal films requirement
        #save_rating(self.f1, self.u4, 1)
        #save_rating(self.f2, self.u4, 2)
        #save_rating(self.f3, self.u4, 3)
        #save_rating(self.f4, self.u4, 4)
        #save_rating(self.f5, self.u4, 5)
        #save_rating(self.f6, self.u4, 6)
        #save_rating(self.f7, self.u4, 7)
        #save_rating(self.f8, self.u4, 8)
        #save_rating(self.f9, self.u4, 9)
        #save_rating(self.f10, self.u4, 10)
        #save_rating(self.f11, self.u4, 1)
        #save_rating(self.f12, self.u4, 2)
        #save_rating(self.f13, self.u4, 3)
        #save_rating(self.f14, self.u4, 4)
        #save_rating(self.f15, self.u4, 5)
        #save_rating(self.f16, self.u4, 6)
        #save_rating(self.f17, self.u4, 7)
        #save_rating(self.f18, self.u4, 8)
        #save_rating(self.f19, self.u4, 9)
        #save_rating(self.f20, self.u4, 10)
        save_rating(self.f21, self.u4, 1)
        save_rating(self.f22, self.u4, 2)
        save_rating(self.f23, self.u4, 3)
        save_rating(self.f24, self.u4, 4)
        save_rating(self.f25, self.u4, 5)
        save_rating(self.f26, self.u4, 6)
        save_rating(self.f27, self.u4, 7)
        save_rating(self.f28, self.u4, 8)
        save_rating(self.f29, self.u4, 9)
        save_rating(self.f30, self.u4, 10)