""" A unit test for palindrome functions. Author: Walker M. White (wmw2) Date: October 10, 2017 (Python 3 Version) """ import cornell import palindrome def test_ispalindrome(): """ Tests the basic palindrome function """ cornell.assert_equals(True, palindrome.ispalindrome('')) cornell.assert_equals(True, palindrome.ispalindrome('B')) cornell.assert_equals(True, palindrome.ispalindrome('BB')) cornell.assert_equals(False, palindrome.ispalindrome('BA')) cornell.assert_equals(True, palindrome.ispalindrome('BOB')) cornell.assert_equals(False, palindrome.ispalindrome('BOA')) cornell.assert_equals(True, palindrome.ispalindrome('ablewasiereisawelba')) cornell.assert_equals(True, palindrome.ispalindrome('amanaplanacanalpanama')) cornell.assert_equals(False, palindrome.ispalindrome('Amanaplanacanalpanama')) cornell.assert_equals(False, palindrome.ispalindrome('amanaplana canalpanama')) def test_ispalindrome2(): """ Tests the palindrome function without case """ cornell.assert_equals(True, palindrome.ispalindrome2('')) cornell.assert_equals(True, palindrome.ispalindrome2('B')) cornell.assert_equals(True, palindrome.ispalindrome2('BB')) cornell.assert_equals(False, palindrome.ispalindrome2('BA')) cornell.assert_equals(True, palindrome.ispalindrome2('BOB')) cornell.assert_equals(False, palindrome.ispalindrome2('BOA')) cornell.assert_equals(True, palindrome.ispalindrome2('ablewasiereisawelba')) cornell.assert_equals(True, palindrome.ispalindrome2('amanaplanacanalpanama')) cornell.assert_equals(True, palindrome.ispalindrome2('Amanaplanacanalpanama')) cornell.assert_equals(False, palindrome.ispalindrome2('amanaplana canalpanama')) def test_ispalindrome_loosely(): """ Tests the palindrome without case, non-letters """ cornell.assert_equals(True, palindrome.ispalindrome_loosely('a**68(&!#7! a')) cornell.assert_equals(True, palindrome.ispalindrome_loosely('A man, a plan, a canal --Panama!')) cornell.assert_equals(False, palindrome.ispalindrome_loosely('A man, a plan, a cabal --Panama!')) # Script Code if __name__ == '__main__': test_ispalindrome() test_ispalindrome2() test_ispalindrome_loosely() print('Module palindrome is working properly')