Esempio n. 1
0
def test_play_again_returns_true_y_input(monkeypatch):
    runner = Runner(Player('1', 'X'), Player('2', 'O'))
    runner._games_played = 1

    monkeypatch.setattr('builtins.input', lambda _: 'Y')
    assert runner._play_again() == True

    monkeypatch.setattr('builtins.input', lambda _: 'y')
    assert runner._play_again() == True
Esempio n. 2
0
def test_play_again_returns_false_non_y_input(monkeypatch):
    runner = Runner(Player('1', 'X'), Player('2', 'O'))
    runner._games_played = 1

    monkeypatch.setattr('builtins.input', lambda _: 'N')
    assert runner._play_again() == False

    monkeypatch.setattr('builtins.input', lambda _: 'n')
    assert runner._play_again() == False

    monkeypatch.setattr('builtins.input', lambda _: 'asdf')
    assert runner._play_again() == False