def setUpClass(self): repository = [ 'apple', 'grape', 'pineaple', 'melon', 'watermelon', 'orange' ] real = RecommendationResult( dict.fromkeys(['apple', 'grape', 'pineaple', 'melon'], 1)) predicted = RecommendationResult( dict.fromkeys(['apple', 'grape', 'orange'], 1)) self.evaluation = Evaluation(predicted, real, len(repository))
class RecommendationResultTests(unittest.TestCase): @classmethod def setUpClass(self): self.result = RecommendationResult({"gimp": 1.5, "inkscape": 3.0, "eog": 1}) def test_str(self): string = "\n 0: inkscape\n 1: gimp\n 2: eog\n" self.assertEqual(self.result.__str__(), string) def test_get_prediction(self): prediction = [("inkscape", 3.0), ("gimp", 1.5), ("eog", 1)] self.assertEqual(self.result.get_prediction(), prediction)
class RecommendationResultTests(unittest.TestCase): @classmethod def setUpClass(self): self.result = RecommendationResult({"gimp": 1.5, "inkscape": 3.0, "eog": 1}) def test_str(self): rec = '\n1: inkscape \t vector-based drawing program\n' rec += '2: gimp \t The GNU Image Manipulation Program\n' # noqa rec += '3: eog \t Eye of GNOME graphics viewer program\n' # noqa self.assertEqual(self.result.__str__(), rec) def test_get_prediction(self): prediction = [("inkscape", 3.0), ("gimp", 1.5), ("eog", 1)] self.assertEqual(self.result.get_prediction(), prediction)
class RecommendationResultTests(unittest.TestCase): @classmethod def setUpClass(self): self.result = RecommendationResult({ "gimp": 1.5, "inkscape": 3.0, "eog": 1 }) def test_str(self): string = "\n 0: inkscape\n 1: gimp\n 2: eog\n" self.assertEqual(self.result.__str__(), string) def test_get_prediction(self): prediction = [("inkscape", 3.0), ("gimp", 1.5), ("eog", 1)] self.assertEqual(self.result.get_prediction(), prediction)
def get_real_results(self, round_partition): return RecommendationResult(round_partition)
def setUpClass(self): self.result = RecommendationResult({"gimp": 1.5, "inkscape": 3.0, "eog": 1})
def setUpClass(self): self.result = RecommendationResult({ "gimp": 1.5, "inkscape": 3.0, "eog": 1 })