def test_type(self): print( "If a there is an error from this test, the code is implemented correctly" ) with self.assertRaises(TypeError): palindrome.pal() print("There is a Type Error ...")
def test_equivalence(self): lengthOG = input( "Please enter the word to test that the length is not changed: ") print("Now enter the same exact word again") this = len(lengthOG) that = len(palindrome.pal()) self.assertTrue(this == that)
def long(str1): str2=str1.split() values=collections.defaultdict(int) max=0 seen=0 for i in str2: values[i]=(palindrome.pal(i)) for v in values: if values[v]>max: max=values[v] for v in values: if values[v]==max: print v seen=1 if seen==0: print "No palindrome present in the text"
def test_correct(): assert pal("lol") == True
def test_single(): assert pal("l") == True
def test_digit(): assert pal("121") == True
def testNegativePalindrome(self): self.assertFalse(pal('dog'))
def testPalindromeFalseNumbers(self): self.assertFalse(pal('123'))
def test_pal2(self): assert palindrome.pal("hello") == False
def test_pal4(self): assert palindrome.pal("121") == True
def test_pal(): assert palindrome.pal('racecar') == True assert palindrome.pal('hockey') == False assert palindrome.pal('toot') == True
def test_empty(self): length = len(palindrome.pal()) self.assertNotEqual(length, 0)
def test_pal(): assert palindrome.pal('madam') == "Is Palindrome" assert palindrome.pal('teacher') == "Not Palindrome" assert palindrome.pal(5) == "Invalid Input"
def test_nonPal(self): result = palindrome.pal('teacher') self.assertEqual(result, "Not Palindrome")
def test_control(self): result = palindrome.pal('racecar') self.assertEqual(result, "Is Palindrome")
def test_pal3(self): assert palindrome.pal("Anna") == False
def test_is_pal(self): self.assertTrue(pal(1001))
def test_pal1(self): assert palindrome.pal("anna") == True
def test_is_not_pal(self): self.assertFalse(pal(1002))
def testPalindromeNumbers(self): self.assertTrue(pal('1112111'))
import palindrome str = input("Enter a String : ") x = palindrome.pal(str) if (x == True): print("It is palindrome") else: print("It is not palindrome")
def testPositivePalindrome(self): self.assertTrue(pal('radar'))
def test_pal3(self): self.assertEqual(palindrome.pal("hello"), False)
def test_multiple(): assert pal("lol lol") == True
def test_pal4(self): self.assertEqual(palindrome.pal("121"), True)
def test_int(): assert pal(121) == None
def test_pal1(self): self.assertEqual(palindrome.pal("anna"), True)
def test_empty(): assert pal("") == None
def test_pal2(self): self.assertEqual(palindrome.pal("Anna"), False)
def test_correct2(): assert pal("no") == False
def test_invalidInput(self): result = palindrome.pal(5) self.assertEqual(result, "Invalid Input")