def test3_printNetflix(self): output = ['4:', 1, 1, 1, 1, '7:', 1, 4, 5, 2] rmse = 0.7 w = StringIO.StringIO() printNetflix(output, rmse, w) self.assertEqual(w.getvalue(), '4:\n1\n1\n1\n1\n7:\n1\n4\n5\n2\nRMSE: 0.700000\n')
def test2_printNetflix(self): output = ['1:', 5, 5, 3, '34964:', 4, 1, '9:', 1] rmse = 1.4 w = StringIO.StringIO() printNetflix(output, rmse, w) self.assertEqual(w.getvalue(), '1:\n5\n5\n3\n34964:\n4\n1\n9:\n1\nRMSE: 1.400000\n')
def test5_printNetflix(self): output = [] rmse = 1.0 w = StringIO.StringIO() printNetflix(output, rmse, w) self.assertEqual(w.getvalue(), '\nRMSE: 1.000000\n')
def test1_printNetflix(self): output = ['100:',3, 2, 1, '5:',4, '256:',1, 2] rmse = 0.8 w = StringIO.StringIO() printNetflix(output, rmse, w) self.assertEqual(w.getvalue(), '100:\n3\n2\n1\n5:\n4\n256:\n1\n2\nRMSE: 0.800000\n')
def test4_printNetflix(self): output = ['1316:', '13160:', '13163:', '3821:'] rmse = 1.0 w = StringIO.StringIO() printNetflix(output, rmse, w) self.assertEqual(w.getvalue(), '1316:\n13160:\n13163:\n3821:\nRMSE: 1.000000\n')