Exemplo n.º 1
0
def test_print_game_stats(capfd):
    winner_prints = [
        "sara has won 0 games", "bob has won 1 game", "tim has won 5 games",
        "julian has won 3 games", "jim has won 1 game"
    ]

    print_game_stats()
    out = capfd.readouterr()[0].splitlines()
    for line in winner_prints:
        assert line in out  # dict so not relying on order of output
Exemplo n.º 2
0
def test_print_game_stats(capfd):
    winner_prints = [
        "sara has won 0 games", "bob has won 1 game", "tim has won 5 games",
        "julian has won 3 games", "jim has won 1 game"
    ]

    print_game_stats()
    output = capfd.readouterr()[0].splitlines()

    # dict + Python 3.7 = insert order should be retained
    for line in winner_prints:
        assert line in output