示例#1
0
 def test_short_anagram(self):
     self.assertTrue(is_anagram("tea", "eat"))
示例#2
0
 def test_punctation_ignored(self):
     phrase1 = "A diet"
     phrase2 = "I'd eat"
     self.assertTrue(is_anagram(phrase1, phrase2))
示例#3
0
 def test_characters_with_accents(self):
     self.assertTrue(is_anagram("Siobhán Donaghy", "Shanghai Nobody"))
示例#4
0
 def test_spaces_ignored(self):
     phrase1 = "William Shakespeare"
     phrase2 = "I am a weakish speller"
     self.assertTrue(is_anagram(phrase1, phrase2))
     self.assertFalse(is_anagram("a b c", "a b d"))
示例#5
0
 def test_different_capitalization(self):
     self.assertTrue(is_anagram("Trey", "Yert"))
     self.assertTrue(is_anagram("Listen", "silent"))
示例#6
0
 def test_same_letters_different_lengths(self):
     self.assertFalse(is_anagram("sinks", "skin"))
示例#7
0
 def test_sink_and_skin(self):
     self.assertTrue(is_anagram("sink", "skin"))
示例#8
0
 def test_different_lengths(self):
     self.assertFalse(is_anagram("tea", "treat"))