コード例 #1
0
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
コード例 #2
0
ファイル: test_rps.py プロジェクト: LenaObeid/Testovani-pokus
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
コード例 #3
0
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
コード例 #4
0
ファイル: rps_test.py プロジェクト: Aendys/Pyworking_testing
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
コード例 #5
0
ファイル: rps_test.py プロジェクト: Aendys/Pyworking_testing
def test_random_valid_play_is_valid():
	for _ in range (100):
		play = rps.random_play()
		assert rps.is_valid_play(play)
コード例 #6
0
ファイル: test_rps.py プロジェクト: vankovat/pytest
def test_random_play_is_always_valid():
    for _ in range(1000):
        assert rps.is_valid_play(rps.random_play())
コード例 #7
0
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
コード例 #8
0
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