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)
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)