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)
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)
def test_getWordPoints_0(): # Example Test assert (getWordPoints('ape', letterPoints) == 5)
def test_getWordPoints_4(): emptyDict = {} assert (getWordPoints('goin\'', emptyDict) == 0)
def test_getWordPoints_3(): assert (getWordPoints('goin\'', letterPoints) == 2 + 1 + 1 + 1)
def test_getWordPoints_2(): assert (getWordPoints('pan', letterPoints) == 5)
def test_getWordPoints_1(): assert (getWordPoints('nape', letterPoints) == 6)
def test_getWordPoints_0(): assert (getWordPoints('ape', letterPoints) == 5)