def test_score_reg_sol(self): rack = "ABCDEFG" sol = solve(rack, wordfile) scr = score(sol) assert len(scr) == 10 assert len(scr[11]) == 2 assert "DECAF" in scr[11] assert "FACED" in scr[11]
def add_word_down(board, word, x, y): length = len(word) score = scrabble.score(word) for i in range(length): elm = board[x + i][y] if elm == 'T': score *= 3 if elm == 'D': score *= 2 if elm == 't': score += scrabble.score(word[i]) * 2 if elm == 'd': score += scrabble.score(word[i]) board[x + i][y] = word[i] return score
def test_whitespace_scores_zero(self): self.assertEqual(0, score(" \t\n"))
def test_empty_word_scores_zero(self): self.assertEqual(0, score(""))
def test_scores_are_case_insensitive(self): self.assertEqual(41, score("oxyphenbutazone"))
def test_complicated_word_scores_more(self): self.assertEqual(22, score("quirky"))
def test_simple_word_scores_the_number_of_letters(self): self.assertEqual(6, score("street"))
def test_scores_other_very_short_word(self): self.assertEqual(4, score('f'))
def test_scores_very_short_word(self): self.assertEqual(1, score('a'))
def test_invalid_word_scores_zero(self): self.assertEqual(0, score('')) self.assertEqual(0, score(' \t\n')) self.assertEqual(0, score('hous3')) self.assertEqual(0, score('wo rd'))
def test_scores_are_case_insensitive(self): self.assertEqual(20, score("MULTIBILLIONAIRE"))
def test_score_one_sol(self): rack = "AA" sol = solve(rack, wordfile) scr = score(sol) assert len(scr) == 1 assert 'AA' in scr[2][0]