Ejemplo n.º 1
0
 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))
Ejemplo n.º 2
0
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)
Ejemplo n.º 3
0
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)
Ejemplo n.º 4
0
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)
Ejemplo n.º 5
0
 def get_real_results(self, round_partition):
     return RecommendationResult(round_partition)
Ejemplo n.º 6
0
 def setUpClass(self):
     self.result = RecommendationResult({"gimp": 1.5, "inkscape": 3.0,
                                         "eog": 1})
Ejemplo n.º 7
0
 def setUpClass(self):
     self.result = RecommendationResult({
         "gimp": 1.5,
         "inkscape": 3.0,
         "eog": 1
     })