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()
Beispiel #2
0
    def test_foo(self):
        # Given

        # When
        Game()

        # Then
        assert True == True
Beispiel #3
0
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"
Beispiel #4
0
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"
Beispiel #5
0
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"
Beispiel #6
0
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"
Beispiel #7
0
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
Beispiel #8
0
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
Beispiel #9
0
 def test_it(self):
     game = Game()
     game.add('Chet')
     assert len(game.players) == 2
Beispiel #10
0
 def setUp(self):
     self.game = Game()
Beispiel #11
0
 def setUp(self):
     self.game = Game()
     self.game.add('Chet')
def game():
    g = Game()
    g.add('a')
    g.add('b')
    return g
Beispiel #13
0
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