def test_get_words():
    exp_result = ['correlates', 'corrosives', 'corrugates']
    words = Criteria()
    words.begins_with('c').ends_with('s').contains('or')
    words.contains_at(('o', 2), ('r', 4)).size_is(10)
    test_result = global_dict.get_words(words)

    assert Ct(test_result) == Ct(exp_result)

    exp_result = ['extrinsic']
    words = Criteria()
    words.begins_with('e').ends_with('c').contains('in')
    words.contains_at(('x', 2), ('r', 4)).size_is(9)
    test_result = scrabble_dict.get_words(words)

    assert Ct(test_result) == Ct(exp_result)
Beispiel #2
0
def test_copy_constructor():
    orig_words = Criteria()
    orig_words.begins_with('d').ends_with('n').contains('mna', 'tion')
    orig_words.contains_at(('t', 6), ('o', 8)).size_is(9)

    new_words = Criteria(orig_words)

    if orig_words.get_begins_with() != new_words.get_begins_with():
        assert False
    if orig_words.get_ends_with() != new_words.get_ends_with():
        assert False
    if Ct(orig_words.get_contains()) != Ct(new_words.get_contains()):
        assert False
    if Ct(orig_words.get_contains_at()) != Ct(new_words.get_contains_at()):
        assert False
    if orig_words.get_size() != new_words.get_size():
        assert False