コード例 #1
0
    def test_user_friendly_score(self):
        # Arrange
        home_score = HomeScore()
        self.home = self.create_home(self.home_type)
        accumulated_points = 20
        total_possible_points = 50

        # Act
        home_score._accumulated_points = accumulated_points
        home_score._total_possible_points = total_possible_points

        # Assert
        self.assertEqual(round((accumulated_points/total_possible_points)*100), home_score.user_friendly_score())
コード例 #2
0
    def test_percent_score_total_possible_points_negative(self):
        # Arrange
        home_score = HomeScore()
        self.home = self.create_home(self.home_type)
        accumulated_points = 20
        total_possible_points = -30

        # Act
        home_score._accumulated_points = accumulated_points
        home_score._total_possible_points = total_possible_points

        # Assert
        self.assertEqual(-1, home_score.percent_score())
コード例 #3
0
    def test_percent_score_accumulated_points_zero_equals_zero(self):
        # Arrange
        home_score = HomeScore()
        self.home = self.create_home(self.home_type)
        accumulated_points = 0
        total_possible_points = 30

        # Act
        home_score._accumulated_points = accumulated_points
        home_score._total_possible_points = total_possible_points
        home_score.eliminate_home()

        # Assert
        self.assertEqual(0, home_score.percent_score())