Ejemplo n.º 1
0
class TestScore:
    @pytest.fixture(autouse=True)
    def game_instance(self):
        self.game = Game('a', 'b')
        self.player_a = self.game.player['a']
        self.player_b = self.game.player['b']
        self.player_a.bout_wins = BOUTS_TO_WIN - 1
        
    def test_match_win_increases(self):
        a = self.player_a
        a.throw = 'Rock'
        self.game.judge()
        assert a.match_wins == 1
        assert a.bout_wins == 0
        
    def test_winner_is_set(self):
        a, b = self.player_a, self.player_b
        a.throw = 'Rock'
        b.throw = 'Scissors'
        a.match_wins =  MATCHES_TO_WIN - 1
        self.game.judge()
        assert a.match_wins == 2
        assert a.bout_wins == 0
        assert self.game.winner == 'a'