def test_error3(self):
     """
     Test when (rounded) guess is exactly right
     """
     netflix_read()
     error_squared = netflix_error(913, 320468, 3.0)
     self.assertEqual(error_squared, 0)
 def test_read1(self):
     """
     Test that cache imports
     """
     netflix_read()
     num_keys = actual_rating.keys()
     self.assertNotEqual(num_keys, 0)
 def test_netflix_read_3(self):
     """ netflix_read_3 """
     input_dic = {}
     store_rating = {}
     reader = StringIO("2043:\n2044:\n2045:\n1111111")
     netflix_read(reader, input_dic, store_rating)
     self.assertEqual(input_dic, {2045: [1111111]})
 def test_netflix_read_1(self):
     """ netflix_read_1 """
     input_dic = {}
     store_rating = {}
     reader = StringIO("2043:\n555555\n666666\n777777\n")
     netflix_read(reader, input_dic, store_rating)
     self.assertEqual(input_dic, {2043: [555555, 666666, 777777]})
 def test_read4(self):
     """
     Test that cache imports
     """
     netflix_read()
     num_keys = customers_avg_weighted.keys()
     self.assertNotEqual(num_keys, 0)
 def test_read2(self):
     """
     Test that cache imports
     """
     netflix_read()
     num_keys = movie_year.keys()
     self.assertNotEqual(num_keys, 0)
 def test_error1(self):
     """
     Test when guess is too small
     """
     netflix_read()
     error_squared = netflix_error(10010, 1462925, 3.6)
     self.assertEqual("{:.2f}".format(error_squared), "0.16")
 def test_guess3(self):
     """
     Test that guess is a float
     """
     netflix_read()
     guess = netflix_guess(1200, 855860)
     self.assertIsInstance(guess, float)
 def test_netflix_read_4(self):
     """ netflix_read_4 """
     input_dic = {}
     store_rating = {}
     reader = StringIO("2042:\n2043:\n000001\n2044:\n2045:\n1111111")
     netflix_read(reader, input_dic, store_rating)
     self.assertEqual(store_rating, {2043: [], 2045: []})
 def test_error2(self):
     """
     Test when guess is too big
     """
     netflix_read()
     error_squared = netflix_error(5733, 1168036, 3.7)
     self.assertEqual("{:.2f}".format(error_squared), "2.89")
 def test_netflix_read_2(self):
     """ netflix_read_2 """
     input_dic = {}
     store_rating = {}
     reader = StringIO(
         "2043:\n555555\n666666\n777777\n2044:\n888888\n9999999\n")
     netflix_read(reader, input_dic, store_rating)
     self.assertEqual(store_rating, {2043: [], 2044: []})
 def test_guess1(self):
     """
     Test that guess is above 0
     """
     netflix_read()
     guess = netflix_guess(788, 613501)
     positive = guess > 0
     self.assertTrue(positive)
 def test_guess2(self):
     """
     Test that guess is below 6
     """
     netflix_read()
     guess = netflix_guess(939, 531806)
     small = guess < 6
     self.assertTrue(small)
예제 #14
0
 def test_read_3(self):
     """Test netflix_read for a string"""
     string = 'abc\n'
     error = False
     try:
         netflix_read(string)
     except ValueError:
         error = True
     self.assertTrue(error)
예제 #15
0
 def test_read_3(self):
     """ test reading empty line
     """
     line = "\n"
     val, ind = netflix_read(line)
     self.assertEqual(val, -1)
     self.assertEqual(ind, -1)
예제 #16
0
 def test_read_2(self):
     """ tests reading customer_id
     """
     line = "1417435\n"
     val, ind = netflix_read(line)
     self.assertEqual(val, 1417435)
     self.assertEqual(ind, 0)
예제 #17
0
 def test_read_1(self):
     """ tests reading movie_id:
     """
     line = "2043:\n"
     val, ind = netflix_read(line)
     self.assertEqual(val, 2043)
     self.assertEqual(ind, 1)
예제 #18
0
 def test_read2(self):
     r = StringIO("70:\n9999\n999999\n9999999999")
     read2 = netflix_read(r)
     self.assertEqual(read2, {
         10: ['1', '2', '3', '4'],
         70: ['9999', '999999', '9999999999']
     })
예제 #19
0
 def test_read_3(self):
     """ test reading empty line
     """
     line = "\n"
     val, ind = netflix_read(line)
     self.assertEqual(val, -1)
     self.assertEqual(ind, -1)
예제 #20
0
 def test_read_2(self):
     """ tests reading customer_id
     """
     line = "1417435\n"
     val, ind = netflix_read(line)
     self.assertEqual(val, 1417435)
     self.assertEqual(ind, 0)
예제 #21
0
    def test_eval_1(self):
        input_dict = netflix_read(self.input1, [])
        predictions_dict = netflix_eval(input_dict)
        self.assertEqual(list(predictions_dict.keys())[0], 1000)

        prediction = float(str(predictions_dict[1000][2326571])[:4])
        self.assertEqual(prediction, 3.22)
예제 #22
0
 def test_read_1(self):
     """ tests reading movie_id:
     """
     line = "2043:\n"
     val, ind = netflix_read(line)
     self.assertEqual(val, 2043)
     self.assertEqual(ind, 1)
예제 #23
0
 def test_read_2 (self) :
     s    = "2043:\n1417435\n2312054\n462685\n"
     to_predict = netflix_read(s)
     self.assertEqual(1, len(to_predict))
     self.assertEqual(1417435, (to_predict[2043])[0])
     self.assertEqual(2312054, (to_predict[2043])[1])
     self.assertEqual(462685, (to_predict[2043])[2])
예제 #24
0
 def test_read_1(self):
     """
         Tests read to see if it reads a movie line correctly
     """
     s_line = "1:\n"
     i, j = netflix_read(s_line)
     self.assertEqual(i, True)
     self.assertEqual(j, 1)
예제 #25
0
 def test_read_2(self):
     """
         Tests read to see if it reads a customer id correctly
     """
     s_line = "1564536453\n"
     i, j = netflix_read(s_line)
     self.assertEqual(i, False)
     self.assertEqual(j, 1564536453)
예제 #26
0
 def test_read_3(self):
     """
         Tests read to see if it reads a multidigit movie line correctly
     """
     s_line = "100253:\n"
     i, j = netflix_read(s_line)
     self.assertEqual(i, True)
     self.assertEqual(j, 100253)
예제 #27
0
 def test_read_4(self):
     '''
         Test the netflix_read() function, which takes a line
         of input and parses to an int
     '''
     string_input = "100000"
     result = netflix_read(string_input)
     self.assertEqual(result, 100000)
예제 #28
0
 def test_read_3(self):
     """
     Reads a customer id
     """
     temp1 = "30878\n"
     temp2, temp3, temp4 = netflix_read(temp1, 0)
     self.assertEqual(temp2, 30878)
     self.assertEqual(temp3, 0)
     self.assertEqual(temp4, 0)
예제 #29
0
 def test_read_2(self):
     """
     Reads a customer id
     """
     temp1 = "12345\n"
     temp2, temp3, temp4 = netflix_read(temp1, 0)
     self.assertEqual(temp2, 12345)
     self.assertEqual(temp3, 0)
     self.assertEqual(temp4, 0)
예제 #30
0
 def test_read_1(self):
     """
     Reads a movie id
     """
     temp1 = "12345:\n"
     temp2, temp3, temp4 = netflix_read(temp1, 0)
     self.assertEqual(temp2, 12345)
     self.assertEqual(temp3, 1)
     self.assertEqual(temp4, 12345)
예제 #31
0
 def test_read3(self):
     r = StringIO("1:\n2\n3:\n4\n5:\n6")
     read3 = netflix_read(r)
     self.assertEqual(
         read3, {
             10: ['1', '2', '3', '4'],
             70: ['9999', '999999', '9999999999'],
             1: ['2'],
             3: ['4'],
             5: ['6']
         })
 def test_read_1(self):
     s = StringIO(
         "10005:\n254775\n1892654\n469365\n793736\n926698\n10:\n1952305\n1531863\n"
     )
     i = netflix_read(s)
     j = i.items()
     self.assertEqual(
         i, {
             10: [1952305, 1531863],
             10005: [254775, 1892654, 469365, 793736, 926698]
         })
예제 #33
0
    def test_eval_3(self):
        input_dict = netflix_read(self.input1, [])
        predictions_dict = netflix_eval(input_dict)

        prediction = float(str(predictions_dict[1000][977808])[:4])
        self.assertEqual(prediction, 2.77)

        prediction = float(str(predictions_dict[1000][1960212])[:4])
        self.assertEqual(prediction, 3.2)

        prediction = float(str(predictions_dict[1000][79755])[:4])
        self.assertEqual(prediction, 3.77)
예제 #34
0
    def test_eval_2(self):
        input_dict = netflix_read(self.input1, [])
        predictions_dict = netflix_eval(input_dict)

        prediction = float(str(predictions_dict[1000][2251189])[:4])
        self.assertEqual(prediction, 3.06)

        prediction = float(str(predictions_dict[1000][2368043])[:4])
        self.assertEqual(prediction, 2.87)

        prediction = float(str(predictions_dict[1000][929584])[:4])
        self.assertEqual(prediction, 3.93)
 def test_read_1 (self) :
     input_string = StringIO("1:\n"\
         "30878\n"\
         "26\n"\
         "10:\n"\
         "23\n"\
         "54\n"\
         "20:\n"\
         "30\n"\
         "26\n"\
         "54\n")
     dictionary = {1 : (30878, 26), 10 : (23, 54), 20 : (30, 26, 54)}
     self.assertEqual(dictionary, netflix_read(input_string))
예제 #36
0
 def test_read_5(self):
     r = StringIO("2043:\n1417435\n")
     i = netflix_read(r)
     self.assertEqual(i, "2043:")
예제 #37
0
 def test_read_1 (self) :
     s    = "2043:\n1417435\n"
     to_predict = netflix_read(s)
     self.assertEqual(1, len(to_predict))
     self.assertEqual(1417435, (to_predict[2043])[0])
예제 #38
0
 def test_read_3(self):
     r = StringIO("1:\n30878\n")
     i = netflix_read(r)
     self.assertEqual(i, "1:")
예제 #39
0
 def test_read_4(self):
     r = StringIO("4783:")
     i = netflix_read(r)
     self.assertEqual(i, "4783:")
예제 #40
0
 def test_read_3 (self) : #movie number without next line
     r    = StringIO("2043:")
     movie_1 = netflix_read(r)
     self.assertEqual(movie_1,  -2043)
예제 #41
0
 def test_read_1(self):
     r = StringIO("")
     i = netflix_read(r)
     self.assertEqual(i, None)
예제 #42
0
 def test_read_1 (self) :
     r = StringIO("1:\n30878\n")
     a = netflix_read(r)
     print(a)
     self.assertEqual(a,  {'1': {0: '30878'}})
예제 #43
0
	def test_netflix_read_1(self):
		r = StringIO("")
		self.assertEqual(netflix_read(r), [])
예제 #44
0
 def test_read_3 (self) :
     s = "8209"
     movies = netflix_read(s)
     self.assertEqual(movies, 8209)
예제 #45
0
 def test_read_3 (self) :
     s = "1904905\n"
     i, j = netflix_read(s)
     self.assertNotEqual(i, 1904906)
예제 #46
0
 def test_read_2 (self) :
     s = "1001"
     movies = netflix_read(s)
     self.assertEqual(movies, 1001)
예제 #47
0
 def test_read_1 (self) :
     s = "3"
     movies = netflix_read(s)
     self.assertEqual(movies, 3)
예제 #48
0
	def test_netflix_read_2(self):
		r = StringIO("500:")
		self.assertEqual(netflix_read(r), r.getvalue())
 def test_read_3 (self) :
     input_string = StringIO("")
     dictionary = {}
     self.assertEqual(dictionary, netflix_read(input_string))
예제 #50
0
 def test_read_2 (self) :
     r = StringIO("1:\n30878\n2647871\n1283744\n")
     a = netflix_read(r)
     print(a)
     self.assertEqual(a,  {'1': {0: '30878', 1: '2647871', 2: '1283744'}})
예제 #51
0
 def test_read_2 (self) : #customer number with next line
     r    = StringIO("2043\n")
     cust_1 = netflix_read(r)
     self.assertEqual(cust_1,  2043)
 def test_read_2 (self) :
     input_string = StringIO("1:\n3\n275\n2:\n2\n454")
     dictionary = {1 : (3,275), 2 : (2, 454)}
     self.assertEqual(dictionary, netflix_read(input_string))
예제 #53
0
 def test_read_4 (self) : #movie number without next line 
     r    = StringIO("462685")
     cust_1 = netflix_read(r)
     self.assertEqual(cust_1,  462685)
예제 #54
0
 def test_read2 (self) :
     r = StringIO ("70:\n9999\n999999\n9999999999")
     read2 = netflix_read (r)
     self.assertEqual (read2, {10: ['1', '2', '3', '4'], 70: ['9999', '999999', '9999999999']})
예제 #55
0
 def test_read_3 (self) :
     r = StringIO("1:\n30878\n10:\n1952305\n1531863\n")
     a = netflix_read(r)
     print(a)
     self.assertEqual(a,  {'1': {0: '30878'}, '10': {0: '1952305', 1: '1531863'}})
예제 #56
0
 def test_read_1 (self) :
     s = "1:\n"
     i, j = netflix_read(s)
     self.assertEqual(i,  1)
     self.assertEqual(j, ":")
예제 #57
0
 def test_read1 (self) :
     r = StringIO ("10:\n1\n2\n3\n4")
     read1 = netflix_read (r)
     self.assertDictEqual (read1, {10: ['1', '2', '3', '4']})
예제 #58
0
 def test_read_2 (self) :
     s = "2488120\n"
     i, j = netflix_read(s)
     self.assertEqual(i, 2488120)
     self.assertEqual(j, "")
예제 #59
0
 def test_read3 (self) :
     r = StringIO ("1:\n2\n3:\n4\n5:\n6")
     read3 = netflix_read (r)
     self.assertEqual (read3, {10: ['1', '2', '3', '4'], 70: ['9999', '999999', '9999999999'], 1: ['2'], 3: ['4'], 5: ['6']})
 def test_read_and_eval (self) :
     r    = StringIO("1: \n548064\n2488120\n4:\n 2498512\n 2573419\n")
     i = netflix_read(r)
     self.assertNotEqual(i, [] )
     v = netflix_eval()
     self.assertEqual(type(v), list)