def test_english_words(self, grds=grds): with open('wordlist.txt', 'r') as f: ws = f.read().strip().split() for g in grds: res = ruzzles(g) for w in res: self.assertTrue(w in ws)
def test_hidden_words(self, grds=grds): for g in grds: res = ruzzles(g) for w in res: cns = build_chains(w, g) at_least_one = \ functools.reduce(lambda x,y: x or y, \ map(valid_chain, cns)) self.assertTrue(at_least_one, (cns, w, g))
def test_char_times_words(self, grds=grds): for g in grds: res = ruzzles(g) for w in res: for c in set(w): self.assertTrue(w.count(c) <= ''.join(g).count(c))
def test_len_words(self, grds=grds): for g in grds: res = ruzzles(g) for w in res: self.assertTrue(len(w) in range(3, len(g)*len(g[0]) +1))
def test_sorted_res(self, grds=grds): for g in grds: res = ruzzles(g) self.assertEqual(res, sorted(res))