Esempio n. 1
0
def test_not_really_random():
    # If your xkcd-style password comes out like this, maybe you shouldn't
    # use it
    eq_(random_words(nwords=4, lang="en", bits_per_word=0), "the the the the")

    # This not only tests random_ascii_words, it makes sure we didn't end
    # up with 'eos' as a very common Japanese word
    eq_(random_ascii_words(nwords=4, lang="ja", bits_per_word=0), "rt rt rt rt")
Esempio n. 2
0
def test_not_really_random():
    # If your xkcd-style password comes out like this, maybe you shouldn't
    # use it
    assert random_words(nwords=4, lang='en', bits_per_word=0) == 'the the the the'

    # This not only tests random_ascii_words, it makes sure we didn't end
    # up with 'eos' as a very common Japanese word
    assert random_ascii_words(nwords=4, lang='ja', bits_per_word=0) == '00 00 00 00'
Esempio n. 3
0
def test_not_really_random():
    # If your xkcd-style password comes out like this, maybe you shouldn't
    # use it
    eq_(random_words(nwords=4, lang='en', bits_per_word=0), 'the the the the')

    # This not only tests random_ascii_words, it makes sure we didn't end
    # up with 'eos' as a very common Japanese word
    eq_(random_ascii_words(nwords=4, lang='ja', bits_per_word=0), '1 1 1 1')
Esempio n. 4
0
def test_not_enough_ascii():
    with pytest.raises(ValueError):
        random_ascii_words(lang='zh', bits_per_word=16)
Esempio n. 5
0
def test_not_enough_ascii():
    random_ascii_words(lang='zh', bits_per_word=14)
Esempio n. 6
0
def test_not_enough_ascii():
    random_ascii_words(lang='zh')
Esempio n. 7
0
def test_not_enough_ascii():
    random_ascii_words(lang="zh")
Esempio n. 8
0
def test_not_enough_ascii():
    with pytest.raises(ValueError):
        random_ascii_words(lang='zh', bits_per_word=16)