Ejemplo n.º 1
0
 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 ...")
Ejemplo n.º 2
0
 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"
Ejemplo n.º 4
0
def test_correct():
    assert pal("lol") == True
Ejemplo n.º 5
0
def test_single():
    assert pal("l") == True
Ejemplo n.º 6
0
def test_digit():
    assert pal("121") == True
Ejemplo n.º 7
0
 def testNegativePalindrome(self):
   self.assertFalse(pal('dog'))
Ejemplo n.º 8
0
 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
Ejemplo n.º 12
0
 def test_empty(self):
     length = len(palindrome.pal())
     self.assertNotEqual(length, 0)
Ejemplo n.º 13
0
def test_pal():
    assert palindrome.pal('madam') == "Is Palindrome"
    assert palindrome.pal('teacher') == "Not Palindrome"
    assert palindrome.pal(5) == "Invalid Input"
Ejemplo n.º 14
0
 def test_nonPal(self):
     result = palindrome.pal('teacher')
     self.assertEqual(result, "Not Palindrome")
Ejemplo n.º 15
0
 def test_control(self):
     result = palindrome.pal('racecar')
     self.assertEqual(result, "Is Palindrome")
 def test_pal3(self):
     assert palindrome.pal("Anna") == False
Ejemplo n.º 17
0
 def test_is_pal(self):
     self.assertTrue(pal(1001))
 def test_pal1(self):
     assert palindrome.pal("anna") == True
Ejemplo n.º 19
0
 def test_is_not_pal(self):
     self.assertFalse(pal(1002))
Ejemplo n.º 20
0
 def testPalindromeNumbers(self):
   self.assertTrue(pal('1112111'))
Ejemplo n.º 21
0
import palindrome

str = input("Enter a String : ")
x = palindrome.pal(str)
if (x == True):
    print("It is palindrome")
else:
    print("It is not palindrome")
Ejemplo n.º 22
0
 def testPositivePalindrome(self):
   self.assertTrue(pal('radar'))
Ejemplo n.º 23
0
 def test_pal3(self):
     self.assertEqual(palindrome.pal("hello"), False)
Ejemplo n.º 24
0
def test_multiple():
    assert pal("lol lol") == True
Ejemplo n.º 25
0
 def test_pal4(self):
     self.assertEqual(palindrome.pal("121"), True)
Ejemplo n.º 26
0
def test_int():
    assert pal(121) == None
Ejemplo n.º 27
0
 def test_pal1(self):
     self.assertEqual(palindrome.pal("anna"), True)
Ejemplo n.º 28
0
def test_empty():
    assert pal("") == None
Ejemplo n.º 29
0
 def test_pal2(self):
     self.assertEqual(palindrome.pal("Anna"), False)
Ejemplo n.º 30
0
def test_correct2():
    assert pal("no") == False
Ejemplo n.º 31
0
 def test_invalidInput(self):
     result = palindrome.pal(5)
     self.assertEqual(result, "Invalid Input")