def test_is_playable(): g = Game() assert not g.is_playable() g.add('one') assert not g.is_playable() g.add('two') assert g.is_playable()
def test_foo(self): # Given # When Game() # Then assert True == True
def test_current_category_is_rock(): test_game = Game() test_game.add('Chet') test_game.add('Pat') test_game.roll(7) for i in range(2): test_game.roll(4) assert test_game._current_category == "Rock"
def test_current_category_is_sports(): test_game = Game() test_game.add('Chet') test_game.add('Pat') test_game.roll(6) for i in range(2): test_game.roll(4) assert test_game._current_category == "Sports"
def test_current_category_is_science(): test_game = Game() test_game.add('Chet') test_game.add('Pat') test_game.roll(5) for i in range(2): test_game.roll(4) assert test_game._current_category == "Science"
def test_current_category_is_pop(): test_game = Game() test_game.add('Chet') test_game.add('Pat') test_game.roll(4) for i in range(2): test_game.roll(4) assert test_game._current_category == "Pop"
def main(): random.seed(1) not_a_winner = False game = Game() game.add('Chet') game.add('Pat') game.add('Sue') while True: game.roll(random.randrange(5) + 1) if random.randrange(9) == 7: not_a_winner = game.wrong_answer() else: not_a_winner = game.was_correctly_answered() if not not_a_winner: break
from trivia import Game with open('randomSeq.txt') as f: f.readline() winner_range = f.readline().strip().split(',')[:-1] winner_range.reverse() f.readline() f.readline() rolls = f.readline().strip().split(',')[:-1] rolls.reverse() game = Game() game.add('Chet') game.add('Pat') game.add('Sue') while True: game.roll(int(rolls.pop())) if int(winner_range.pop()) == 7: not_a_winner = game.wrong_answer() else: not_a_winner = game.was_correctly_answered() if not not_a_winner: break
def test_it(self): game = Game() game.add('Chet') assert len(game.players) == 2
def setUp(self): self.game = Game()
def setUp(self): self.game = Game() self.game.add('Chet')
def game(): g = Game() g.add('a') g.add('b') return g
def test_ask_question(): test_game = Game() test_game.add('Chet') test_game.add('Pat') test_game.roll(7) assert test_game.questions['Rock'] == 1