Exemple #1
0
def main():
    # sample palindrome words: moon, Anna

    print('This program takes a word and checks it to see if',
          'the word is palindrome.')

    flag = 'y'
    while flag.lower() == 'y':
        word = input('Input a word: ')

        if palindromeChecker(word.lower()):
            print('>>>', word, 'is Palindrome.\n')
        else:
            print('>>>', word, 'is not Palindrome.\n')

        flag = input('Do you want to continue (y/n)? ')
        print('___________________________')
        print()

    # print out the docstring
    print(palindromeChecker.__doc__)
 def test_string_false(self, mock_input):
     result = palindrome.palindromeChecker()
     self.assertEqual(result, False)
 def test_special_chars2(self, mock_input):
     result = palindrome.palindromeChecker()
     self.assertEqual(result, False)
 def test_ints(self, mock_input):
     self.assertRaises(TypeError, palindrome.palindromeChecker())
 def test_string_of_ints(self, mock_input):
     result = palindrome.palindromeChecker()
     self.assertEqual(result, True)
Exemple #6
0
def test_simple2(monkeypatch):
    monkeypatch.setattr('sys.stdin', simpleWord2)
    assert palindrome.palindromeChecker() == False
Exemple #7
0
def test_complex2(monkeypatch):
    monkeypatch.setattr('sys.stdin', complexInput2)
    assert palindrome.palindromeChecker() == True
	def test_add(self):
		self.assertEqual(palindrome.palindromeChecker("racecar"), True)
		self.assertEqual(palindrome.palindromeChecker("Parrot"), False)
Exemple #9
0
def test_special_chars2(monkeypatch):
    monkeypatch.setattr('sys.stdin', specialInput2)
    assert palindrome.palindromeChecker() == False
Exemple #10
0
def test_string_of_numbers(monkeypatch):
    monkeypatch.setattr('sys.stdin', numberInput)
    assert palindrome.palindromeChecker() == True
Exemple #11
0
def test_spaces():
	assert palindrome.palindromeChecker("dog god") == True
Exemple #12
0
def test_numbers():
	assert palindrome.palindromeChecker("123454321") == True
Exemple #13
0
def test_answer():
	assert palindrome.palindromeChecker("racecar") == True
	assert palindrome.palindromeChecker("parrot") == False
	def test_add_numbers(self):
		self.assertEqual(palindrome.palindromeChecker("123454321"), True)
 def test_complex2(self, mock_input):
     result = palindrome.palindromeChecker()
     self.assertEqual(result, True)
Exemple #16
0
def test_normal_input2(monkeypatch):
    monkeypatch.setattr('sys.stdin', stringInput2)
    assert palindrome.palindromeChecker() == False
	def test_add_spaces(self):
		self.assertEqual(palindrome.palindromeChecker("dog god"), True)