Beispiel #1
0
def test_zeroWordLen():
    """Requesting words of zero length"""
    grid, words5 = createTestGrid()
    wordLen = 0
    matches = wordSolver040919a.findWords(grid, words5, wordLen, False)
    assert (matches is not None)
    assert (len(matches) == 0)
Beispiel #2
0
def test_emptyTestDict():
    """testDict is empty"""
    grid, _ = createTestGrid()
    wordLen = 1
    matches = wordSolver040919a.findWords(grid, [], wordLen, False)
    assert (matches is not None)
    assert (len(matches) == 0)
Beispiel #3
0
def test_emptyGrid():
    """grid is empty dict"""
    grid = {}
    words = []
    wordLen = 1
    matches = wordSolver040919a.findWords(grid, words, wordLen, False)
    assert (matches is not None)
    assert (len(matches) == 0)
Beispiel #4
0
def test_invalidGridType():
    """grid is not a dict"""
    grid = []
    words = []
    wordLen = 1
    matches = wordSolver040919a.findWords(grid, words, wordLen, False)
    assert (matches is not None)
    assert (len(matches) == 0)
Beispiel #5
0
def test_noneGrid():
    """grid is None"""
    grid = None
    words = []
    wordLen = 1
    matches = wordSolver040919a.findWords(grid, words, wordLen, False)
    assert (matches is not None)
    assert (len(matches) == 0)
Beispiel #6
0
def test_findFiveLetterWords():
    """Find a list of five-letter words"""
    wordLen = 5
    grid, words5 = createTestGrid()
    matches = wordSolver040919a.findWords(grid, words5, wordLen, False)
    assert (matches is not None)
    for word in words5:
        assert (word in matches)
    for word in matches:
        assert (word in words5)
Beispiel #7
0
def test_findOneLetterWords():
    """Find a list of five-letter words"""
    wordLen = 1
    grid, _ = createTestGrid()
    words1 = ['i', 'o']
    matches = wordSolver040919a.findWords(grid, words1, wordLen, False)
    assert (matches is not None)
    for word in words1:
        assert (word in matches)
    for word in matches:
        assert (word in words1)