Esempio n. 1
0
def test_guess_playing(mocker):
    pplayer = PersistantPlayer()
    mocker.patch('builtins.input', pplayer.make_guess)
    mocker.patch('sys.stdout', pplayer)
    values = sorted(random.sample(range(MIN, MAX + 1), NUM_VALUES))
    run_game(values)
    values = sorted(random.sample(range(MIN, MAX + 1), NUM_VALUES))
    run_game(values)
    values = sorted(random.sample(range(MIN, MAX + 1), NUM_VALUES))
    run_game(values)
Esempio n. 2
0
def test_cheater(mocker):
    cheater = Cheater()
    mocker.patch('builtins.input', cheater.make_guess)
    mocker.patch('sys.stdout', cheater)
    values = sorted(random.sample(range(MIN, MAX + 1), NUM_VALUES))
    cheater.set_vals(values)
    run_game(values)
    values = sorted(random.sample(range(MIN, MAX + 1), NUM_VALUES))
    cheater.set_vals(values)
    run_game(values)
    values = sorted(random.sample(range(MIN, MAX + 1), NUM_VALUES))
    cheater.set_vals(values)
    run_game(values)