Exemplo n.º 1
0
 def test_detects_three_anagrams(self):
     candidates = [
         "gallery", "ballerina", "regally", "clergy", "largely", "leading"
     ]
     self.assertEqual(
         detect_anagrams("allergy", candidates),
         ["gallery", "regally", "largely"])
Exemplo n.º 2
0
 def test_custom_1(self):
     candidates = ["heolo", "world", "zombies", "pants"]
     self.assertEqual(detect_anagrams("lohel", candidates), [])
Exemplo n.º 3
0
 def test_capital_word_is_not_own_anagram(self):
     self.assertEqual(detect_anagrams("BANANA", ["Banana"]), [])
Exemplo n.º 4
0
 def test_anagrams_must_use_all_letters_exactly_once(self):
     self.assertEqual(detect_anagrams("tapper", ["patter"]), [])
Exemplo n.º 5
0
 def test_does_not_detect_a_anagram_if_the_original_word_is_repeated(self):
     self.assertEqual(detect_anagrams("go", ["go Go GO"]), [])
Exemplo n.º 6
0
 def test_does_not_detect_a_word_as_its_own_anagram(self):
     self.assertEqual(detect_anagrams("banana", ["Banana"]), [])
Exemplo n.º 7
0
 def test_detects_anagrams_using_case_insensitive_possible_matches(self):
     candidates = ["cashregister", "Carthorse", "radishes"]
     self.assertEqual(
         detect_anagrams("orchestra", candidates), ["Carthorse"])
Exemplo n.º 8
0
 def test_detects_anagrams_using_case_insensitive_subjec(self):
     candidates = ["cashregister", "carthorse", "radishes"]
     self.assertEqual(
         detect_anagrams("Orchestra", candidates), ["carthorse"])
Exemplo n.º 9
0
 def test_does_not_detect_non_anagrams_with_identical_checksum(self):
     self.assertEqual(detect_anagrams("mass", ["last"]), [])
Exemplo n.º 10
0
 def test_does_not_detect_identical_words(self):
     candidates = ["corn", "dark", "Corn", "rank", "CORN", "cron", "park"]
     self.assertEqual(detect_anagrams("corn", candidates), ["cron"])
Exemplo n.º 11
0
 def test_detects_anagram(self):
     candidates = ["enlists", "google", "inlets", "banana"]
     self.assertEqual(detect_anagrams("listen", candidates), ["inlets"])
Exemplo n.º 12
0
 def test_does_not_detect_anagram_subsets(self):
     self.assertEqual(detect_anagrams("good", ["dog", "goody"]), [])
Exemplo n.º 13
0
 def test_detects_two_anagrams(self):
     candidates = ["stream", "pigeon", "maters"]
     self.assertEqual(
         detect_anagrams("master", candidates), ["stream", "maters"])
Exemplo n.º 14
0
 def test_does_not_detect_false_positives(self):
     self.assertEqual(detect_anagrams("galea", ["eagle"]), [])
Exemplo n.º 15
0
 def test_detects_simple_anagram(self):
     candidates = ["tan", "stand", "at"]
     self.assertEqual(detect_anagrams("ant", candidates), ["tan"])
Exemplo n.º 16
0
 def test_no_matches(self):
     candidates = ["hello", "world", "zombies", "pants"]
     self.assertEqual(detect_anagrams("diaper", candidates), [])