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")
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")
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")
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")
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")
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")
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]))
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!")
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]))
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'))
def test_is_palindrome(self): self.assertEqual(is_palindrome("101"), True) self.assertEqual(is_palindrome("4668731596684224866951378664"), True) self.assertEqual(is_palindrome("133"), False)