Пример #1
0
    def test_same_word_isnt_anagram(self):
        self.assertEqual(
            [],
            detect_anagrams('banana', ['banana'])
        )

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

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