예제 #1
0
파일: solutions3.py 프로젝트: subhan/Euler
def is_palindrome(num, base=True):
    """
    >>> is_palindrome(585)
    True
    """
    if not solutions.is_palindrome(num):
        return False
    return solutions.is_palindrome(convert_to_base(num))
예제 #2
0
    def test_one_character(self):
        teststr = "a"

        expected = True
        actual = is_palindrome(teststr)

        self.assertEqual(expected, actual)
예제 #3
0
    def test_negative_odd(self):
        teststr = "abcdefg"
        
        expected = False
        actual = is_palindrome(teststr)

        self.assertEqual(expected, actual)
예제 #4
0
    def test_case_9(self):
        string = 'abcdefghihgfeddcba'

        expected = False
        actual = is_palindrome(string)

        self.assertEqual(expected, actual)
예제 #5
0
    def test_case_7(self):
        string = 'abcdefghhgfedcba'

        expected = True
        actual = is_palindrome(string)

        self.assertEqual(expected, actual)
예제 #6
0
    def test_case_5(self):
        string = 'abb'

        expected = False
        actual = is_palindrome(string)

        self.assertEqual(expected, actual)
예제 #7
0
    def test_case_2(self):
        string = 'a'

        expected = True
        actual = is_palindrome(string)

        self.assertEqual(expected, actual)