Пример #1
0
def main():
    global run
    run = True
    while run:
        user_input = input("Insert word to test : ")
        if user_input.lower() == "exit":
            # global run
            run = False
            return
        words.insert(0, user_input)
        if len(words) == 6:
            words.pop()
        print(words)
        print(check_palindrome(user_input))
Пример #2
0
import sys

from palindrome import check_palindrome

if __name__ == "__main__":

    if len(sys.argv) != 2:
        print("Usage:")
        print("python test.py word")
        print("where word is the word to be tested as a palindrome")
        sys.exit(0)

    word = sys.argv[1]
    check_palindrome(word)
def test_tacodog():
    assert palindrome.check_palindrome("tacodog") is False
def test_tacocat():
    assert palindrome.check_palindrome("tacocat") is True
def test_racecar():
    assert palindrome.check_palindrome("racecar") is True
Пример #6
0
 def test_palindrome(self):
     self.assertEqual(check_palindrome("level"), "level is a Palindrome")
     self.assertEqual(check_palindrome(45), "45 is not a Palindrome")
     self.assertEqual(check_palindrome(44), "44 is a Palindrome")
     self.assertEqual(check_palindrome(" "), "You entered nothing")
 def test_tacodog(self):
     self.assertFalse(palindrome.check_palindrome("tacodog"))
 def test_tacocat(self):
     self.assertTrue(palindrome.check_palindrome("tacocat"))
 def test_racecar(self):
     self.assertTrue(palindrome.check_palindrome("racecar"))