Ejemplo n.º 1
0
def test_move_wrong_guess_normal():
    cg, wg, game_over, turns, msg = hangman.move(sw="cat",
                                                 cg=["c"],
                                                 wg=["x"],
                                                 ng=["l"],
                                                 turns=6)

    assert cg == ["c"]
    assert wg == ["x", "l"]
    assert game_over == False
    assert turns == 5
Ejemplo n.º 2
0
def test_move_repeat_correct_normal():
    cg, wg, game_over, turns, msg = hangman.move(sw="cat",
                                                 cg=["c"],
                                                 wg=["x"],
                                                 ng=["c"],
                                                 turns=6)

    assert cg == ["c"]
    assert wg == ["x"]
    assert game_over == False
    assert turns == 6
Ejemplo n.º 3
0
def test_move_correct_guess_win():
    cg, wg, game_over, turns, msg = hangman.move(sw="cat",
                                                 cg=["c", "t"],
                                                 wg=["x"],
                                                 ng=["a"],
                                                 turns=6)

    assert cg == ["c", "t", "a"]
    assert wg == ["x"]
    assert game_over == True
    assert turns == 6
    assert msg == "You win , The word is cat"
Ejemplo n.º 4
0
def test_move_wrong_guess_lose():
    cg, wg, game_over, turns, msg = hangman.move(
        sw="cat",
        cg=["c"],
        wg=["x", "m", "n", "o", "r", "y"],
        ng=["l"],
        turns=1)

    assert cg == ["c"]
    assert wg == ["x", "m", "n", "o", "r", "y", "l"]
    assert game_over == True
    assert turns == 0