Пример #1
0
 def conversion_test(self):
     test_string = 'PAYPALISHIRING'
     test_row_number = 4
     solution = Solution()
     actual_result = solution.convert(test_string, test_row_number)
     expected_result = 'PINALSIGYAHRPI'
     self.assertEqual(actual_result, expected_result)
Пример #2
0
class TestLongestPalindrome(unittest.TestCase):
    def setUp(self):
        self.s = Solution()

    @data(
        ["ABC", 3, "ABC"],
        ["ABCDE", 3, "AEBDC"],
        ["ABCDEF", 3, "AEBDFC"],
        ["ABCDEFGHI", 3, "AEIBDFHCG"],
        ["PAYPALISHIRING", 3, "PAHNAPLSIIGYIR"],
    )
    @unpack
    def test(self, input_string, num_rows, expected):
        self.assertEqual(self.s.convert(input_string, num_rows), expected)
Пример #3
0
 def test_isValid_Solution(self):
     sol = Solution()
     self.assertEqual('PAHNAPLSIIGYIR', sol.convert('PAYPALISHIRING', 3))
     self.assertEqual('PINALSIGYAHRPI', sol.convert('PAYPALISHIRING', 4))