예제 #1
0
def test_outputWordPointPairs_2():
    # Write to file
    words = ['ape', 'nape', 'pipe', 'pan', 'go']
    pointWordList = []
    for w in words:
        pointWordList.append((getWordPoints(w, letterPoints), w))

    outputWordPointPairs(pointWordList, 'apenpigon', True)
    try:
        f = open('apenpigon.txt')
        line = f.readline()
        count = 0

        while line:
            line = line.strip()
            wordPoints = line.split()
            if (wordPoints[0] not in words) or \
               int(wordPoints[1])!= getWordPoints(wordPoints[0], letterPoints):
                assert (False)
            count = count + 1
            line = f.readline()

        if count != len(words):
            assert (False)
        f.close()
    except:
        assert (False)
예제 #2
0
def test_outputWordPointPairs_1():
    words = ['ape', 'nape', 'pipe', 'pan', 'goin\'']
    pointWordList = []
    for w in words:
        pointWordList.append((getWordPoints(w, letterPoints), w))

    outputWordPointPairs(pointWordList, 'apenpigon\'', False)
예제 #3
0
def test_getWordPoints_0():
    # Example Test
    assert (getWordPoints('ape', letterPoints) == 5)
예제 #4
0
def test_getWordPoints_4():
    emptyDict = {}
    assert (getWordPoints('goin\'', emptyDict) == 0)
예제 #5
0
def test_getWordPoints_3():
    assert (getWordPoints('goin\'', letterPoints) == 2 + 1 + 1 + 1)
예제 #6
0
def test_getWordPoints_2():
    assert (getWordPoints('pan', letterPoints) == 5)
예제 #7
0
def test_getWordPoints_1():
    assert (getWordPoints('nape', letterPoints) == 6)
예제 #8
0
def test_getWordPoints_0():
    assert (getWordPoints('ape', letterPoints) == 5)