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

        self.assertEqual(
            [],
            detect_anagrams('go', 'go Go GO'.split())
        )
Example #2
0
 def test_multiple_anagrams(self):
     self.assertEqual(
         'gallery regally largely'.split(),
         detect_anagrams(
             'allergy',
             'gallery ballerina regally clergy largely leading'.split()
         )
     )
Example #3
0
 def test_no_matches(self):
     self.assertEqual(
         [],
         detect_anagrams('diaper', 'hello world zombies pants'.split())
     )
Example #4
0
 def test_anagrams_are_case_insensitive(self):
     self.assertEqual(
         ['Carthorse'],
         detect_anagrams('Orchestra',
                         'cashregister Carthorse radishes'.split())
     )
Example #5
0
 def test_detect_anagram(self):
     self.assertEqual(
         ['inlets'],
         detect_anagrams('listen', 'enlists google inlets banana'.split())
     )
Example #6
0
 def test_eliminate_anagram_subsets(self):
     self.assertEqual(
         [],
         detect_anagrams('good', 'dog goody'.split())
     )
Example #7
0
 def test_does_not_confuse_different_duplicates(self):
     self.assertEqual(
         [],
         detect_anagrams('galea', ['eagle'])
     )
Example #8
0
 def test_detect_multiple_anagrams(self):
     self.assertEqual(
         ['stream', 'maters'],
         detect_anagrams('master', 'stream pigeon maters'.split())
     )
Example #9
0
 def test_detect_simple_anagram(self):
     self.assertEqual(
         ['tan'],
         detect_anagrams('ant', 'tan stand at'.split())
     )