def test_palindrome(self):
        test_string = 'asaf'  # is NOT a palindrome

        self.assertEqual(is_palindrome(test_string), False,
            "Word %s is not palindrome!" % test_string)

        test_string = 'nolemonnomelon'  # is apalindrome

        self.assertEqual(is_palindrome(test_string), True,
            "Word %s is palindrome!" % test_string)

        test_string = 'nolemonnomelno'  # is NOT a palindrome

        self.assertEqual(is_palindrome(test_string), False,
            "Word %s is not palindrome!" % test_string)
    def test_palindrome_true(self):
        # Arrange
        checked_str = "tacocat"
        expected_result = True

        # Act
        result = is_palindrome(checked_str)

        # Assert
        self.assertEqual(result, expected_result,
                         "Result should be " + str(expected_result))
    def test_palindrome_false(self):
        # Arrange
        checked_str = "not a palindrome"
        expected_result = False

        # Act
        result = is_palindrome(checked_str)

        # Assert
        self.assertEqual(result, expected_result,
                         "Result should be " + str(expected_result))
 def test_sentence(self):
     self.assertTrue(is_palindrome('a man, a plan, a canal: Panama'))
 def test_word(self):
     self.assertTrue(is_palindrome('lol'))
 def test_not_palindrome(self):
     self.assertFalse(is_palindrome('chair'))
 def test_white_spaces(self):
     self.assertTrue(is_palindrome('abc      cba'))
 def test_empty_string(self):
     self.assertTrue(is_palindrome(''))
Exemple #9
0
def test(characters, expected):
    result = is_palindrome(characters)
    assert result == expected
 def test_01(self):
     result = is_palindrome('lol')
     self.assertTrue(result)
 def test_05(self):
     result = is_palindrome('chair')
     self.assertFalse(result)
 def test_04(self):
     result = is_palindrome('abc      cba')
     self.assertTrue(result)
 def test_03(self):
     result = is_palindrome('')
     self.assertTrue(result)