Exemple #1
0
def test_1():
    game = Game()
    word_1 = 'look'
    char = 'o'
    game.visible_word = ['*', '*', '*', '*']
    game.remains = len(word_1)
    result = game._check_word(word_1, char)
    assert result == 'Hit!', 'Wrong method output'
    assert game.remains == 2 and game.curr_mistake == 0, 'Wrong counters'
    assert game.visible_word == ['*', 'o', 'o', '*'], 'Wrong word output'
    print('TEST 1 is OK')
Exemple #2
0
def test_4():
    game = Game()
    word = 'rrrrr'
    char = 'r'
    game.visible_word = ['*', '*', '*', '*', '*']
    game.remains = len(word)
    result = game._check_word(word, char)
    assert result == 'Hit!', 'Wrong method output'
    assert game.remains == 0 and game.curr_mistake == 0, 'Wrong counters'
    assert game.visible_word == ['r', 'r', 'r', 'r', 'r'], 'Wrong word output'
    print('TEST 4 is OK')
Exemple #3
0
def test_2():
    game = Game()
    word = 'qwerr'
    char = 'l'
    game.visible_word = ['*', '*', '*', '*', '*']
    game.remains = len(word)
    result = game._check_word(word, char)
    assert result == 'Missed, mistake 1 out of 5', 'Wrong method output'
    assert game.remains == len(word) and game.curr_mistake == 1, 'Wrong counters'
    assert game.visible_word == ['*', '*', '*', '*', '*'], 'Wrong word output'
    print('TEST 2 is OK')