示例#1
0
 def test_caches_increment_count_1(self):
     """
         Tests to see that review_prediction_count is incremented by 1
     """
     cache = Caches()
     cache.increment_count()
     self.assertEqual(cache.review_prediction_count, 1)
示例#2
0
 def test_caches_increment_rmse_1(self):
     """
         Tests to see that rmse is incremented by the value provided
     """
     cache = Caches()
     cache.increment_rmse(0.2335785)
     self.assertEqual(cache.rmse, 0.2335785)
示例#3
0
 def test_caches_increment_rmse_3(self):
     """
         Tests to see that rmse is incremented by the value provided
     """
     cache = Caches()
     cache.rmse = -1
     cache.increment_rmse(0)
     self.assertEqual(cache.rmse, -1)
示例#4
0
 def test_caches_increment_rmse_2(self):
     """
         Tests to see that rmse is incremented by the value provided
     """
     cache = Caches()
     cache.rmse = 25
     cache.increment_rmse(-2.6)
     self.assertEqual(cache.rmse, 22.4)
示例#5
0
 def test_print_summary_1(self):
     """
         Tests print_summary to see if it calculates RMSE and total records
     """
     writer = StringIO()
     cache = Caches()
     cache.review_prediction_count = 1
     netflix_print_summary(writer, cache)
     self.assertEqual(writer.getvalue(), "RMSE: 0.00\n")
示例#6
0
 def test_print_summary_3(self):
     """
         Tests print_summary to see if it calculates RMSE and
         total records with commas
     """
     writer = StringIO()
     cache = Caches()
     cache.rmse = 395803456.452523
     cache.review_prediction_count = 2135468
     netflix_print_summary(writer, cache)
     self.assertEqual(writer.getvalue(), "RMSE: 13.61\n")
示例#7
0
 def test_caches_init_1(self):
     """
         Tests to see that Caches' review_prediction_count
         value is initialized to 0
     """
     cache = Caches()
     self.assertEqual(cache.review_prediction_count, 0)
示例#8
0
 def test_eval_1(self):
     """
         Tests the predictions of the customer's rating of movie
     """
     cache = Caches()
     prediction = netflix_eval(864647, 3196, cache)
     self.assertEqual(prediction, 3.628994439391601)
示例#9
0
 def test_eval_3(self):
     """
         Tests the predictions of the customer's rating of movie
         where prediction was greater than 5
     """
     cache = Caches()
     prediction = netflix_eval(1007965, 4522, cache)
     self.assertEqual(prediction, 5.0)
示例#10
0
 def test_eval_2(self):
     """
         Tests the predictions of the customer's rating of movie
         where prediction was less than 1
     """
     cache = Caches()
     prediction = netflix_eval(420915, 7120, cache)
     self.assertEqual(prediction, 1.0)
示例#11
0
 def test_caches_init_3(self):
     """
         Tests to see that Caches' test version has actual ratings
     """
     cache = Caches()
     self.assertEqual(cache.actual_ratings[2874][747972], 4)
示例#12
0
 def test_caches_init_2(self):
     """
         Tests to see that Caches' rmse value is initialized to 0
     """
     cache = Caches()
     self.assertEqual(cache.rmse, 0)