コード例 #1
0
ファイル: palTest.py プロジェクト: swinforb/inclassAgain
 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 ...")
コード例 #2
0
ファイル: palTest.py プロジェクト: swinforb/inclassAgain
 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"
コード例 #4
0
def test_correct():
    assert pal("lol") == True
コード例 #5
0
def test_single():
    assert pal("l") == True
コード例 #6
0
def test_digit():
    assert pal("121") == True
コード例 #7
0
 def testNegativePalindrome(self):
   self.assertFalse(pal('dog'))
コード例 #8
0
 def testPalindromeFalseNumbers(self):
   self.assertFalse(pal('123'))
コード例 #9
0
 def test_pal2(self):
     assert palindrome.pal("hello") == False
コード例 #10
0
 def test_pal4(self):
     assert palindrome.pal("121") == True
コード例 #11
0
def test_pal():
    assert palindrome.pal('racecar') == True
    assert palindrome.pal('hockey') == False
    assert palindrome.pal('toot') == True
コード例 #12
0
ファイル: palTest.py プロジェクト: swinforb/inclassAgain
 def test_empty(self):
     length = len(palindrome.pal())
     self.assertNotEqual(length, 0)
コード例 #13
0
ファイル: test_pal.py プロジェクト: Hippo-Jedi/Pali-WordCount
def test_pal():
    assert palindrome.pal('madam') == "Is Palindrome"
    assert palindrome.pal('teacher') == "Not Palindrome"
    assert palindrome.pal(5) == "Invalid Input"
コード例 #14
0
 def test_nonPal(self):
     result = palindrome.pal('teacher')
     self.assertEqual(result, "Not Palindrome")
コード例 #15
0
 def test_control(self):
     result = palindrome.pal('racecar')
     self.assertEqual(result, "Is Palindrome")
コード例 #16
0
 def test_pal3(self):
     assert palindrome.pal("Anna") == False
コード例 #17
0
 def test_is_pal(self):
     self.assertTrue(pal(1001))
コード例 #18
0
 def test_pal1(self):
     assert palindrome.pal("anna") == True
コード例 #19
0
 def test_is_not_pal(self):
     self.assertFalse(pal(1002))
コード例 #20
0
 def testPalindromeNumbers(self):
   self.assertTrue(pal('1112111'))
コード例 #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")
コード例 #22
0
 def testPositivePalindrome(self):
   self.assertTrue(pal('radar'))
コード例 #23
0
 def test_pal3(self):
     self.assertEqual(palindrome.pal("hello"), False)
コード例 #24
0
def test_multiple():
    assert pal("lol lol") == True
コード例 #25
0
 def test_pal4(self):
     self.assertEqual(palindrome.pal("121"), True)
コード例 #26
0
def test_int():
    assert pal(121) == None
コード例 #27
0
 def test_pal1(self):
     self.assertEqual(palindrome.pal("anna"), True)
コード例 #28
0
def test_empty():
    assert pal("") == None
コード例 #29
0
 def test_pal2(self):
     self.assertEqual(palindrome.pal("Anna"), False)
コード例 #30
0
def test_correct2():
    assert pal("no") == False
コード例 #31
0
 def test_invalidInput(self):
     result = palindrome.pal(5)
     self.assertEqual(result, "Invalid Input")