Exemple #1
0
def test_insert_new_word(chat_id, lang, index):
    print('test_insert_new_word')
    create_table()
    insert_new_word(chat_id, lang, index)
    new_word_status = check_status(chat_id, lang, index)
    assert len(new_word_status) == 1
    assert new_word_status[0] == 'new'
Exemple #2
0
def test_not_known_words_id(chat_id, lang, indexes_new, indexes_gw, indexes_kn,
                            exp_indexes):
    create_table()
    for index in indexes_new + indexes_gw + indexes_kn:
        insert_new_word(chat_id, lang, index)
    for index in indexes_gw:
        change_status_word(chat_id, lang, index, 'good_word')
    for index in indexes_kn:
        change_status_word(chat_id, lang, index, 'known')
    indexes = not_known_words_id(chat_id, lang)
    assert indexes == exp_indexes
Exemple #3
0
def test_indexes_learn(chat_id, lang, indexes_new, indexes_gw, indexes_kn,
                       expected_indexes):
    print('test_change_status_word')
    create_table()
    for index in indexes_new + indexes_gw + indexes_kn:
        insert_new_word(chat_id, lang, index)
    for index in indexes_gw:
        change_status_word(chat_id, lang, index, 'good_word')
    for index in indexes_kn:
        change_status_word(chat_id, lang, index, 'known')
    indexes = indexes_learn(chat_id, lang)
    assert indexes == expected_indexes
Exemple #4
0
def test_status_word(chat_id, lang, word_id, status, expected_status):
    create_table()
    insert_new_word(chat_id, lang, word_id)
    change_status_word(chat_id, lang, word_id, status)
    status = status_word(chat_id, lang, word_id)
    assert status == expected_status