def test_getAveRatingCostumer_3(self): r = StringIO.StringIO( "COSTUMERS_RATE\n1 3.4\n2 4.4\n3 2.4\n5 1.2\n4 2.2\nMOVIE_RATES\n2 2.5\n1 3.5" ) getCatch(r) b = getAveRatingCostumer('6') self.assert_(b == 0.0)
def test_predict_3(self): r = StringIO.StringIO( "COSTUMERS_RATE\n1 3.4\n2 4.4\n3 2.4\n5 1.2\n4 2.2\nMOVIE_RATES\n2 2.5\n1 3.5\n5 5" ) getCatch(r) b = predict('5', '5') self.assert_(b == 3.1)
def test_netflix_solve_3 (self) : re = StringIO.StringIO("COSTUMERS_RATE\n1 3.4\n2 4.4\n3 2.4\n5 1.2\n4 2.2\nMOVIE_RATES\n2 2.5\n1 3.5") getCatch(re) r = StringIO.StringIO("1:\n2:") w = StringIO.StringIO() netflix_solve(r, w) self.assert_(w.getvalue() == "1:\n2:\n")
def test_netflix_solve_3(self): re = StringIO.StringIO( "COSTUMERS_RATE\n1 3.4\n2 4.4\n3 2.4\n5 1.2\n4 2.2\nMOVIE_RATES\n2 2.5\n1 3.5" ) getCatch(re) r = StringIO.StringIO("1:\n2:") w = StringIO.StringIO() netflix_solve(r, w) self.assert_(w.getvalue() == "1:\n2:\n")
def test_getCatch_1 (self) : r = StringIO.StringIO("COSTUMERS_RATE\n1 3.4\n2 4.4\n3 2.4\n5 1.2\n4 2.2\nMOVIE_RATES\n2 2.5\n1 3.5\n5 5") getCatch(r) mRating = movies_Rating cRating = customers_Rating cId = customers_ID self.assert_(cId[0] == '1') self.assert_(cId[1] == '2') self.assert_(cId[2] == '3') self.assert_(cId[3] == '5') self.assert_(cId[4] == '4') self.assert_(cRating[0] == '3.4') self.assert_(cRating[1] == '4.4') self.assert_(cRating[2] == '2.4') self.assert_(cRating[3] == '1.2') self.assert_(cRating[4] == '2.2') self.assert_(mRating[1] == '3.5') self.assert_(mRating[2] == '2.5') self.assert_(mRating[5] == '5')
def test_getCatch_1(self): r = StringIO.StringIO( "COSTUMERS_RATE\n1 3.4\n2 4.4\n3 2.4\n5 1.2\n4 2.2\nMOVIE_RATES\n2 2.5\n1 3.5\n5 5" ) getCatch(r) mRating = movies_Rating cRating = customers_Rating cId = customers_ID self.assert_(cId[0] == '1') self.assert_(cId[1] == '2') self.assert_(cId[2] == '3') self.assert_(cId[3] == '5') self.assert_(cId[4] == '4') self.assert_(cRating[0] == '3.4') self.assert_(cRating[1] == '4.4') self.assert_(cRating[2] == '2.4') self.assert_(cRating[3] == '1.2') self.assert_(cRating[4] == '2.2') self.assert_(mRating[1] == '3.5') self.assert_(mRating[2] == '2.5') self.assert_(mRating[5] == '5')
def test_predict_3 (self) : r = StringIO.StringIO("COSTUMERS_RATE\n1 3.4\n2 4.4\n3 2.4\n5 1.2\n4 2.2\nMOVIE_RATES\n2 2.5\n1 3.5\n5 5") getCatch(r) b = predict('5', '5') self.assert_(b == 3.1)
def test_getAveRatingCostumer_3 (self) : r = StringIO.StringIO("COSTUMERS_RATE\n1 3.4\n2 4.4\n3 2.4\n5 1.2\n4 2.2\nMOVIE_RATES\n2 2.5\n1 3.5") getCatch(r) b = getAveRatingCostumer('6') self.assert_(b == 0.0)