def setUp(self):
        rating_levels = [
            RatingLevel(minimum_score, text) for minimum_score, text in [
                (0, 'worst'),
                (30, 'oh-oh'),
                (60, 'OK-ish'),
                (90, 'great'),
                (100, 'over the top'),
            ]
        ]

        self.evaluator = Evaluator(rating_levels)
class RatingTestCase(TestCase):
    def setUp(self):
        rating_levels = [
            RatingLevel(minimum_score, text) for minimum_score, text in [
                (0, 'worst'),
                (30, 'oh-oh'),
                (60, 'OK-ish'),
                (90, 'great'),
                (100, 'over the top'),
            ]
        ]

        self.evaluator = Evaluator(rating_levels)

    @params(
        (-2.3, 'worst'),
        (0.0, 'worst'),
        (4.2, 'worst'),
        (29.3, 'worst'),
        (30.0, 'oh-oh'),
        (59.5, 'oh-oh'),
        (60.0, 'OK-ish'),
        (89.7, 'OK-ish'),
        (90.0, 'great'),
        (99.9, 'great'),
        (100.0, 'over the top'),
        (111.1, 'over the top'),
    )
    def test_get_rating(self, score, expected):
        actual = self.evaluator.get_rating_text(score)
        self.assertEqual(actual, expected)
class RatingTestCase(TestCase):

    def setUp(self):
        rating_levels = [
            RatingLevel(minimum_score, text)
            for minimum_score, text in [
                (  0, 'worst'),
                ( 30, 'oh-oh'),
                ( 60, 'OK-ish'),
                ( 90, 'great'),
                (100, 'over the top'),
            ]
        ]

        self.evaluator = Evaluator(rating_levels)

    @params(
        ( -2.3, 'worst'),
        (  0.0, 'worst'),
        (  4.2, 'worst'),
        ( 29.3, 'worst'),
        ( 30.0, 'oh-oh'),
        ( 59.5, 'oh-oh'),
        ( 60.0, 'OK-ish'),
        ( 89.7, 'OK-ish'),
        ( 90.0, 'great'),
        ( 99.9, 'great'),
        (100.0, 'over the top'),
        (111.1, 'over the top'),
    )
    def test_get_rating(self, score, expected):
        actual = self.evaluator.get_rating_text(score)
        self.assertEqual(actual, expected)
    def setUp(self):
        rating_levels = [
            RatingLevel(minimum_score, text)
            for minimum_score, text in [
                (  0, 'worst'),
                ( 30, 'oh-oh'),
                ( 60, 'OK-ish'),
                ( 90, 'great'),
                (100, 'over the top'),
            ]
        ]

        self.evaluator = Evaluator(rating_levels)
Example #5
0
 def setUp(self):
     self.questionnaire, self.rating_levels = self._load_data()
     self.questions = self.questionnaire.get_questions()
     self.evaluator = Evaluator(self.rating_levels)