def test_random_play_is_fairish(): #test nemusi vzdy projit plays = [rps.random_play() for _ in range(1000)] #1000x hraje pocitac #testuji, jestli z 1000 pokusu je aspon 100x rock, paper or scissors assert plays.count("rock") > 100 assert plays.count("paper") > 100 assert plays.count("scissors") > 100
def test_random_play_is_fair(): plays = {'rock': 0, 'paper': 0, 'scissors': 0} for _ in range(10000): play = rps.random_play() plays[play] += 1 for value in plays.values(): assert value > 3000
def test_random_play_is_fairish(): """This test relies on some kind of fairness in the randomness. That is of course not 100% accurate, but should work anyway.""" # spoléha na nahodnost plays = [rps.random_play() for _ in range(1000)] assert plays.count("rock") > 100 assert plays.count("paper") > 100 assert plays.count("scissors") > 100
def test_random_play_is_fairish(): plays = [rps.random_play() for _ in range (100)] assert plays.count('rock') > 10 assert plays.count('paper') > 10 assert plays.count('scissors') > 10
def test_random_valid_play_is_valid(): for _ in range (100): play = rps.random_play() assert rps.is_valid_play(play)
def test_random_play_is_always_valid(): for _ in range(1000): assert rps.is_valid_play(rps.random_play())
def test_random_play_is_fairish(): """This should work in most universes!""" plays = [rps.random_play() for _ in range(1000)] assert plays.count('rock') > 100 assert plays.count('paper') > 100 assert plays.count('scissors') > 100
def test_random_play_is_valid(): for _ in range(100): play = rps.random_play() assert rps.is_valid_play(play) # is True by to bylo navíc