Exemple #1
0
 def test_word_invalid(self):
     invalid_words = [
         "hello", "world", "hi", "hey", "christmas", "a", "ah", "main"
     ]
     for word in invalid_words:
         self.assertFalse(main.is_palindrome(word),
                          "Invalid word was found True")
Exemple #2
0
 def test_spacing(self):
     valid_phrase = [
         "Step,on, no,          pets", "          Top  spot!",
         "Nolemonnomelon"
     ]
     for phrase in valid_phrase:
         self.assertTrue(main.is_palindrome(phrase),
                         "Valid phrase was found false")
Exemple #3
0
 def test_word_valid(self):
     valid_words = [
         "Racecar", "Anna", "Civic", "Kayak", "Mom", "Refer", "Noon",
         "Repaper"
     ]
     for word in valid_words:
         self.assertTrue(main.is_palindrome(word),
                         "Valid word was found false")
Exemple #4
0
 def test_phrase_invalid(self):
     invalid_phrase = [
         "Hello World!", "My name is", "Is this a Palindrome",
         "Took a trip yesterday", "Pycharm unit test", "Random Phrase"
     ]
     for phrase in invalid_phrase:
         self.assertFalse(main.is_palindrome(phrase),
                          "Invalid phrase was found true")
Exemple #5
0
 def test_punctuation_valid(self):
     valid_phrase = [
         "Step,on, no, pets", "Top spot!", "No: lemon, no melon",
         "Was it a cat I saw?", "Amore, Roma;", "No lemon! no melon!",
         "As I pee-sir-I see Pisa!"
     ]
     for phrase in valid_phrase:
         self.assertTrue(main.is_palindrome(phrase),
                         "Valid phrase was found false")
Exemple #6
0
 def test_phrase_valid(self):
     valid_phrase = [
         "Step on no pets", "Top spot", "No lemon, no melon",
         "Was it a cat I saw", "Amore, Roma", "No lemon no melon",
         "As I pee, sir, I see Pisa!"
     ]
     for phrase in valid_phrase:
         self.assertTrue(main.is_palindrome(phrase),
                         "Valid phrase was found false")
Exemple #7
0
 def test_is_palindrome(self):
     self.assertTrue(main.is_palindrome([]))
     self.assertTrue(main.is_palindrome([1]))
     self.assertTrue(main.is_palindrome([1, 2, 1]))
     self.assertTrue(main.is_palindrome([1, 2, 2, 1]))
     self.assertTrue(main.is_palindrome([1, 2, 3, 2, 1]))
     self.assertTrue(main.is_palindrome([1, 2, 3, 3, 2, 1]))
Exemple #8
0
def test_is_palindrome():
    assert is_palindrome("kayak")
    assert not is_palindrome("success")
    assert is_palindrome("Sator Arepo Tenet Opera Rotas")
    assert is_palindrome("Tu l'as trop ecrase Cesar, ce port-salut!")
Exemple #9
0
 def test_is_not_palindrome(self):
     self.assertFalse(main.is_palindrome([1, 2]))
     self.assertFalse(main.is_palindrome([1, 2, 2]))
     self.assertFalse(main.is_palindrome([1, 2, 3, 1]))
Exemple #10
0
 def test_is_palindrome(self):
     self.assertTrue(main.is_palindrome('aa'))
     self.assertTrue(main.is_palindrome('a'))
     self.assertTrue(main.is_palindrome('abba'))
     self.assertTrue(main.is_palindrome('abccba'))
     self.assertTrue(main.is_palindrome('level'))
     self.assertTrue(main.is_palindrome('Noon'))
     self.assertFalse(main.is_palindrome('ab'))
     self.assertFalse(main.is_palindrome('abccbb'))
     self.assertFalse(main.is_palindrome('Wolf'))
     self.assertFalse(main.is_palindrome('Pen'))
     self.assertFalse(main.is_palindrome('lantern'))
Exemple #11
0
 def test_is_palindrome(self):
     self.assertEqual(is_palindrome("101"), True)
     self.assertEqual(is_palindrome("4668731596684224866951378664"), True)
     self.assertEqual(is_palindrome("133"), False)