예제 #1
0
    def test_update_points_with_0_points_for_the_first_time(self):
        p1 = Player(name='ime1')
        p2 = Player(name='ime2')
        t = Team('me', p1, p2)

        t.add_points(0)

        self.assertEqual(t.points, [0])
예제 #2
0
    def test_update_points_twice(self):
        p1 = Player(name='ime1')
        p2 = Player(name='ime2')
        t = Team('me', p1, p2)
        t.add_points(20)

        t.add_points(20)

        self.assertEqual(t.points, [20, 20])
예제 #3
0
    def test_if_safe_to_txt_creates_file_with_headers_and_first_points(self):
        p1 = Player(name='nikola')
        p3 = Player(name='kolio')
        p2 = Player(name='kole')
        p4 = Player(name='niki')

        team1 = Team('mashinite', p1, p3)
        team2 = Team('slabacite', p2, p4)

        team1.add_points(20)
        team2.add_points(0)
        create_file_with_headers(team1, team2)
        safe_to_txt(team1, team2, first_round=True)
        exp = '     mashinite      |     slabacite      =========================================20                  |0                   '

        with open('results.txt', 'r') as file:
            data = file.read().replace('\n', '')
        self.assertEqual(data, exp)