Esempio n. 1
0
    def test_same_word_isnt_anagram(self):
        self.assertEqual(
            [],
            detect_anagrams('banana', ['banana'])
        )

        self.assertEqual(
            [],
            detect_anagrams('go', 'go Go GO'.split())
        )
Esempio n. 2
0
 def test_detects_three_anagrams(self):
     candidates = [
         "gallery", "ballerina", "regally", "clergy", "largely", "leading"
     ]
     self.assertEqual(
         detect_anagrams("allergy", candidates),
         ["gallery", "regally", "largely"])
Esempio n. 3
0
 def test_detects_three_anagrams(self):
     candidates = [
         "gallery", "ballerina", "regally", "clergy", "largely", "leading"
     ]
     self.assertEqual(
         detect_anagrams("allergy", candidates),
         ["gallery", "regally", "largely"])
Esempio n. 4
0
 def test_multiple_anagrams(self):
     self.assertEqual(
         'gallery regally largely'.split(),
         detect_anagrams(
             'allergy',
             'gallery ballerina regally clergy largely leading'.split()
         )
     )
Esempio n. 5
0
 def test_does_not_detect_anagram_subsets(self):
     self.assertEqual(detect_anagrams("good", ["dog", "goody"]), [])
Esempio n. 6
0
 def test_eliminate_anagram_subsets(self):
     self.assertEqual([], detect_anagrams('good', 'dog goody'.split()))
Esempio n. 7
0
 def test_detect_multiple_anagrams(self):
     self.assertEqual(['stream', 'maters'],
                      detect_anagrams('master',
                                      'stream pigeon maters'.split()))
Esempio n. 8
0
 def test_multiple_anagrams(self):
     self.assertEqual(
         'gallery regally largely'.split(),
         detect_anagrams(
             'allergy',
             'gallery ballerina regally clergy largely leading'.split()))
Esempio n. 9
0
 def test_does_not_confuse_different_duplicates(self):
     self.assertEqual([], detect_anagrams('galea', ['eagle']))
Esempio n. 10
0
 def test_eliminate_anagram_subsets(self):
     self.assertEqual([],
         detect_anagrams('good', 'dog goody'.split()))
Esempio n. 11
0
 def test_detects_two_anagrams(self):
     candidates = ["stream", "pigeon", "maters"]
     self.assertEqual(
         detect_anagrams("master", candidates), ["stream", "maters"])
Esempio n. 12
0
 def test_capital_word_is_not_own_anagram(self):
     self.assertEqual(detect_anagrams("BANANA", ["Banana"]), [])
Esempio n. 13
0
 def test_detects_simple_anagram(self):
     candidates = ["tan", "stand", "at"]
     self.assertEqual(detect_anagrams("ant", candidates), ["tan"])
Esempio n. 14
0
 def test_does_not_detect_false_positives(self):
     self.assertEqual(detect_anagrams("galea", ["eagle"]), [])
Esempio n. 15
0
 def test_no_matches(self):
     self.assertEqual([],
                      detect_anagrams('diaper',
                                      'hello world zombies pants'.split()))
Esempio n. 16
0
    def test_same_word_isnt_anagram(self):
        self.assertEqual([], detect_anagrams('banana', ['banana']))

        self.assertEqual([], detect_anagrams('go', 'go Go GO'.split()))
Esempio n. 17
0
 def test_anagrams_are_case_insensitive(self):
     self.assertEqual(['Carthorse'],
                      detect_anagrams(
                          'Orchestra',
                          'cashregister Carthorse radishes'.split()))
Esempio n. 18
0
 def test_detects_anagrams_using_case_insensitive_subject(self):
     candidates = ["cashregister", "carthorse", "radishes"]
     self.assertEqual(
         detect_anagrams("Orchestra", candidates), ["carthorse"])
Esempio n. 19
0
 def test_does_not_detect_anagram_subsets(self):
     self.assertEqual(detect_anagrams("good", ["dog", "goody"]), [])
Esempio n. 20
0
 def test_does_not_detect_a_anagram_if_the_original_word_is_repeated(self):
     self.assertEqual(detect_anagrams("go", ["go Go GO"]), [])
Esempio n. 21
0
 def test_detects_anagram(self):
     candidates = ["enlists", "google", "inlets", "banana"]
     self.assertEqual(detect_anagrams("listen", candidates), ["inlets"])
Esempio n. 22
0
 def test_no_matches(self):
     candidates = ["hello", "world", "zombies", "pants"]
     self.assertEqual(detect_anagrams("diaper", candidates), [])
Esempio n. 23
0
 def test_no_matches(self):
   self.assertEqual(
     [],
     detect_anagrams(u'diaper', [u'hello', u'world', u'zombies', u'pants'])
   )
Esempio n. 24
0
 def test_detect_multiple_anagrams(self):
     self.assertEqual(['stream', 'maters'],
         detect_anagrams('master', 'stream pigeon maters'.split()))
 def test_does_not_detect_false_positives(self):
     self.assertEqual(detect_anagrams("galea", ["eagle"]), [])
Esempio n. 26
0
 def test_anagrams_are_case_insensitive(self):
     self.assertEqual(['Carthorse'],
         detect_anagrams('Orchestra','cashregister Carthorse radishes'.split()))
 def test_does_not_detect_a_word_as_its_own_anagram(self):
     self.assertEqual(detect_anagrams("banana", ["Banana"]), [])
Esempio n. 28
0
 def test_is_case_insensitive(self):
   self.assertEqual(
     [u'Orchestra'],
     detect_anagrams(u'Orchestra', [u'cashregister', u'Carthorse', u'radishes'])
   )
Esempio n. 29
0
 def test_detect_anagram(self):
     self.assertEqual(['inlets'],
                      detect_anagrams(
                          'listen', 'enlists google inlets banana'.split()))
 def test_detects_simple_anagram(self):
     candidates = ["tan", "stand", "at"]
     self.assertEqual(detect_anagrams("ant", candidates), ["tan"])
Esempio n. 31
0
 def test_does_not_detect_identical_words(self):
     candidates = ["corn", "dark", "Corn", "rank", "CORN", "cron", "park"]
     self.assertEqual(detect_anagrams("corn", candidates), ["cron"])
 def test_does_not_detect_identical_words(self):
     candidates = ["corn", "dark", "Corn", "rank", "CORN", "cron", "park"]
     self.assertEqual(detect_anagrams("corn", candidates), ["cron"])
Esempio n. 33
0
 def test_does_not_detect_non_anagrams_with_identical_checksum(self):
     self.assertEqual(detect_anagrams("mass", ["last"]), [])
Esempio n. 34
0
 def test_detects_two_anagrams(self):
     candidates = ["stream", "pigeon", "maters"]
     self.assertEqual(
         detect_anagrams("master", candidates), ["stream", "maters"])
Esempio n. 35
0
 def test_detects_anagrams_using_case_insensitive_subjec(self):
     candidates = ["cashregister", "carthorse", "radishes"]
     self.assertEqual(
         detect_anagrams("Orchestra", candidates), ["carthorse"])
Esempio n. 36
0
 def test_detects_anagram(self):
     candidates = ["enlists", "google", "inlets", "banana"]
     self.assertEqual(detect_anagrams("listen", candidates), ["inlets"])
Esempio n. 37
0
 def test_detects_anagrams_using_case_insensitive_possible_matches(self):
     candidates = ["cashregister", "Carthorse", "radishes"]
     self.assertEqual(
         detect_anagrams("orchestra", candidates), ["Carthorse"])
Esempio n. 38
0
 def test_does_not_detect_non_anagrams_with_identical_checksum(self):
     self.assertEqual(detect_anagrams("mass", ["last"]), [])
Esempio n. 39
0
 def test_does_not_detect_a_word_as_its_own_anagram(self):
     self.assertEqual(detect_anagrams("banana", ["Banana"]), [])
Esempio n. 40
0
 def test_detects_anagrams_using_case_insensitive_possible_matches(self):
     candidates = ["cashregister", "Carthorse", "radishes"]
     self.assertEqual(
         detect_anagrams("orchestra", candidates), ["Carthorse"])
Esempio n. 41
0
 def test_does_not_detect_a_anagram_if_the_original_word_is_repeated(self):
     self.assertEqual(detect_anagrams("go", ["go Go GO"]), [])
Esempio n. 42
0
 def test_anagrams_must_use_all_letters_exactly_once(self):
     self.assertEqual(detect_anagrams("tapper", ["patter"]), [])
Esempio n. 43
0
 def test_anagrams_must_use_all_letters_exactly_once(self):
     self.assertEqual(detect_anagrams("tapper", ["patter"]), [])
Esempio n. 44
0
 def test_speed(self):
     detect_anagrams(rand_letters(10), [ rand_letters(10) for _ in range(10**6)])
Esempio n. 45
0
 def test_capital_word_is_not_own_anagram(self):
     self.assertEqual(detect_anagrams("BANANA", ["Banana"]), [])
Esempio n. 46
0
 def test_no_matches(self):
     candidates = ["hello", "world", "zombies", "pants"]
     self.assertEqual(detect_anagrams("diaper", candidates), [])
Esempio n. 47
0
 def test_detects_simple_anagram(self):
   self.assertEqual(
     [u'tan'],
     detect_anagrams(u'ant', [u'tan', u'stand', u'at'])
   )
Esempio n. 48
0
 def test_detect_simple_anagram(self):
     self.assertEqual(['tan'],
         detect_anagrams('ant', 'tan stand at'.split()))
Esempio n. 49
0
 def test_eliminates_anagram_subsets(self):
   self.assertEqual(
     [],
     detect_anagrams(u'good', [u'dog', u'goody'])
   )
Esempio n. 50
0
 def test_does_not_confuse_different_duplicates(self):
     self.assertEqual([],
         detect_anagrams('galea', ['eagle']))
Esempio n. 51
0
 def test_detects_multiple_anagrams(self):
   self.assertEqual(
     [u'gallery', u'regally', u'largely'],
     detect_anagrams(u'allergy', [u'gallery', u'ballerina', u'regally', u'clergy', u'largely', u'leading'])
   )
Esempio n. 52
0
 def test_detect_anagram(self):
     self.assertEqual(['inlets'],
         detect_anagrams('listen', 'enlists google inlets banana'.split()))
Esempio n. 53
0
 def test_same_word_isnt_anagram(self):
   self.assertEqual(
     [],
     detect_anagrams(u'banana', [u'banana'])
   )
Esempio n. 54
0
 def test_no_matches(self):
     self.assertEqual([],
         detect_anagrams('diaper', 'hello world zombies pants'.split()))
Esempio n. 55
0
 def test_detect_simple_anagram(self):
     self.assertEqual(['tan'], detect_anagrams('ant',
                                               'tan stand at'.split()))