def test_hardest_select(self): a, b, c = insert_words(*'abc') q.record_answer(a, a) # one correct for a q.record_answer(c, b) # not correct for c self.assertEqual(q.select_most_hard_words_ids(3), [c, b, a])
def test_hardest_and_random(self): a, b, c = insert_words(*'abc') q.record_answer(c, b) # not correct for c res = q.select_most_hard_words_ids(3) self.assertEqual(res[0], c) self.assertIn(a, res) self.assertIn(b, res)
def cram(count): words_ids = q.select_most_hard_words_ids(count) for word_id in words_ids: variant_ids = q.get_translation_variants(word_id, 4) word, t = q.get_word_and_translation(word_id) variants = [q.get_word_and_translation(id)[1] for id in variant_ids] answer = choice_question(word, variants) answer_id = variant_ids[answer] q.record_answer(word_id, variant_ids[answer]) if answer_id == word_id: print(_("Correct!")) else: print(_('Wrong! "{word}" is correctly translated as "{translation}"').format(word=word, translation=t))
def test_hardest_empty(self): self.assertEqual(q.select_most_hard_words_ids(5), [])