def test_validate(self):
     import anagrams
     for test_input1, test_input2, test_output in TestAnagrams.test_cases:
         with self.subTest(i=(test_input1, test_input2)):
             self.assertEqual(anagrams.is_anagram(test_input1, test_input2),
                              test_output)
             self.assertEqual(anagrams.is_anagram(test_input2, test_input1),
                              test_output)
Beispiel #2
0
 def test(self):
     self.assertEqual(is_anagram(self.test1[0], self.test1[1]),
                      self.test1[2])
     self.assertEqual(is_anagram(self.test2[0], self.test2[1]),
                      self.test2[2])
     self.assertEqual(is_anagram(self.test3[0], self.test3[1]),
                      self.test3[2])
     self.assertEqual(is_anagram(self.test4[0], self.test4[1]),
                      self.test4[2])
     self.assertEqual(is_anagram(self.test5[0], self.test5[1]),
                      self.test5[2])
Beispiel #3
0
def test_is_anagram_false():
    eq_(anagrams.is_anagram("a", "b"), False)
Beispiel #4
0
def test_is_anagram():
    eq_(anagrams.is_anagram("abc", "cba"), True)
Beispiel #5
0
def test_is_anagram_multiple_letter_the_same():
    eq_(anagrams.is_anagram("aa", "aaa"), False)
Beispiel #6
0
def test_is_anagram_false_different_capitalization():
    eq_(anagrams.is_anagram("A", "a"), False)
Beispiel #7
0
 def test_different_lengths(self):
     self.assertFalse(is_anagram("tea", "treat"))
Beispiel #8
0
 def test_is_anagram(self):
     self.assertEqual(is_anagram(self.s1, self.s2), True)
Beispiel #9
0
 def test_punctuation_ignored(self):
     phrase1 = "A diet"
     phrase2 = "I'd eat"
     self.assertTrue(is_anagram(phrase1, phrase2))
Beispiel #10
0
 def test_spaces_ignored(self):
     phrase1 = "William Shakespeare"
     phrase2 = "I am a weakish speller"
     self.assertTrue(is_anagram(phrase1, phrase2))
     self.assertTrue(is_anagram("a b c", "a b d"))
Beispiel #11
0
 def test_different_capitalization(self):
     self.assertTrue(is_anagram("Trey", "Yert"))
     self.assertTrue(is_anagram("Listen", "silent"))
Beispiel #12
0
 def test_same_letters_different_lengths(self):
     self.assertFalse(is_anagram("sinks", "skin"))
Beispiel #13
0
 def test_sink_skin(self):
     self.assertTrue(is_anagram("sink", "skin"))
Beispiel #14
0
 def test_is_anagram(self):
     self.assertEqual(is_anagram(self.s1, self.s2), True)
Beispiel #15
0
 def test_is_anagram(self):
     self.assertEqual(anagrams.is_anagram("listen", "silent"), True)
     self.assertEqual(anagrams.is_anagram("aabcd", "dabac"), True)
     self.assertEqual(anagrams.is_anagram("cat", "dog"), False)
     self.assertEqual(anagrams.is_anagram(115, 115), False)
     self.assertEqual(anagrams.is_anagram("lol115", "lol115"), False)
Beispiel #16
0
 def test_short_anagram(self):
     self.assertTrue(is_anagram("tea", "eat"))
Beispiel #17
0
 def test(self):
     self.assertEqual(is_anagram(self.test1[0], self.test1[1]), self.test1[2])
     self.assertEqual(is_anagram(self.test2[0], self.test2[1]), self.test2[2])
     self.assertEqual(is_anagram(self.test3[0], self.test3[1]), self.test3[2])
     self.assertEqual(is_anagram(self.test4[0], self.test4[1]), self.test4[2])
     self.assertEqual(is_anagram(self.test5[0], self.test5[1]), self.test5[2])
def test_is_anagram():
    bool = is_anagram('python', 'thynop')
    assert bool == True