Esempio n. 1
0
def test_display_empty():
    word_shuffler = WordShuffler()

    target_letter = 'e'
    expected_display = 'E word needed.'

    display = word_shuffler.make_display(target_letter)

    assert display == expected_display
Esempio n. 2
0
def test_display_mixed_case():
    all_words = 'THE big bag of words'.split()
    word_shuffler = WordShuffler(all_words)

    word_shuffler['E'] = 'tHe'
    expected_display = 'thE'

    display = word_shuffler.make_display('e')

    assert display == expected_display
Esempio n. 3
0
def test_display_single():
    all_words = 'the big bag of words'.split()
    word_shuffler = WordShuffler(all_words)

    target_letter = 'e'
    word_shuffler[target_letter] = 'the'
    expected_display = 'thE'

    display = word_shuffler.make_display(target_letter)

    assert display == expected_display
Esempio n. 4
0
def test_display():
    all_words = 'lots of words rail the liar from his lair with lira'.split()
    word_shuffler = WordShuffler(all_words)

    target_letter = 'a'
    word_shuffler[target_letter] = 'liar'
    expected_display = 'liAr - raIl, laIr, liRa'

    display = word_shuffler.make_display(target_letter)

    assert display == expected_display
Esempio n. 5
0
def test_display_missing_letter():
    all_words = 'towards a roasted dinner'.split()
    word_shuffler = WordShuffler(all_words)

    target_letter = 'w'
    word_shuffler[target_letter] = 'roasted'
    expected_display = 'W word needed.'

    display = word_shuffler.make_display(target_letter)

    assert display == expected_display
Esempio n. 6
0
def test_display_with_space():
    all_words = 'towards a roasted dinner'.split()
    word_shuffler = WordShuffler(all_words)

    target_letter = 'w'
    word_shuffler[target_letter] = 'to wards'
    expected_display = 'toWards'

    display = word_shuffler.make_display(target_letter)

    assert display == expected_display
Esempio n. 7
0
def test_display_repeated_letter_chosen():
    all_words = 'respect the sceptre of a spectre'.split()
    word_shuffler = WordShuffler(all_words)

    target_letter = 'e'
    word_shuffler[target_letter] = 'respEct'
    expected_display = 'respEct - scepTre, specTre'

    display = word_shuffler.make_display(target_letter)

    assert display == expected_display
Esempio n. 8
0
def test_display_unknown_words():
    all_words = 'THE gob bag of words'.split()
    word_shuffler = WordShuffler(all_words)

    target_letter = 'o'
    word_shuffler[target_letter] = 'bog'
    expected_display = 'bOg (unknown word) - gOb'

    display = word_shuffler.make_display(target_letter)

    assert display == expected_display
Esempio n. 9
0
def test_find_other_words_new_lines():
    all_words = StringIO('''\
the
gab
bag
of
words
''')
    word_shuffler = WordShuffler(all_words)

    target_letter = 'G'
    word_shuffler[target_letter] = 'Bag'
    expected_display = 'baG - gaB'

    display = word_shuffler.make_display(target_letter)

    assert display == expected_display