def test_wordlist_1() -> None: lang = "en" d = _wordlists.wordlist(lang) assert isinstance(d, list) assert len(d) == 2048 length = _wordlists.language_length(lang) assert length == 2048
def test_wordlist_1(self): lang = "en" d = _wordlists.wordlist(lang) self.assertIsInstance(d, list) self.assertEqual(len(d), 2048) length = _wordlists.language_length(lang) self.assertEqual(length, 2048)
def test_wordlist_2(self): lang = "fakeen" # missing file for language 'fakeen'' self.assertRaises(ValueError, _wordlists.load_lang, lang) # _wordlists.load_lang(lang) # dictionary length (must be a power of two fname = "fakeenglish.txt" filename = path.join(path.dirname(__file__), "test_data", fname) self.assertRaises(ValueError, _wordlists.load_lang, lang, filename) # _wordlists.load_lang(lang, filename) # dinamically add a new language lang = "en2" fname = "english.txt" filename = path.join(path.dirname(__file__), "test_data", fname) _wordlists.load_lang(lang, filename) length = _wordlists.language_length(lang) self.assertEqual(length, 2048)
def test_wordlist_2() -> None: lang = "fakeen" # missing file for language 'fakeen'' err_msg = "Missing file for language 'fakeen'" with pytest.raises(BTClibValueError, match=err_msg): _wordlists.load_lang(lang) # dictionary length (must be a power of two fname = "fakeenglish.txt" filename = path.join(path.dirname(__file__), "test_data", fname) err_msg = "invalid wordlist length: " with pytest.raises(BTClibValueError, match=err_msg): _wordlists.load_lang(lang, filename) # dinamically add a new language lang = "en2" fname = "english.txt" filename = path.join(path.dirname(__file__), "test_data", fname) _wordlists.load_lang(lang, filename) length = _wordlists.language_length(lang) assert length == 2048