def test_small_n(self): input = 'abcdef' output = 'acebdf' self.assertEqual(convert(input, 2), output) self.assertEqual(convert(input, 1), input) input = 'abcd' output = 'abdc' self.assertEqual(convert(input, 3), output)
def test_convert(): assert convert('PAYPALISHIRING', 3) == 'PAHNAPLSIIGYIR' assert convert('PAYPALISHIRING', 4) == 'PINALSIGYAHRPI' assert convert('PAYPALISHIRING', 1) == 'PAYPALISHIRING'
def test_example1(self): input = "PAYPALISHIRING" output = 'PAHNAPLSIIGYIR' self.assertEqual(convert(input, 3), output)
def test_large_n(self): input = 'abcde' self.assertEqual(convert(input, 6), input) input = 'abcdefabcdefabcdefabcdef' output = 'acbbdcaedffeefdacbbcadfe' self.assertEqual(convert(input, 11), output)
def test_capitals(self): input = 'ABCdefG' output = 'AeBdfCG' self.assertEqual(convert(input, 3), output)
def test_spaces(self): input = 'ab cdef' output = 'adbce f' self.assertEqual(convert(input, 3), output)
def test_example2(self): input = 'PAYPALISHIRING' output = 'PINALSIGYAHRPI' self.assertEqual(convert(input, 4), output)
def test_if_one_row_return_same_list(self): s = "TEST1TOTEST" actual = convert(s, 1) self.assertEquals(s, actual)
def test_weird_case(self): s = "A" expected = "A" actual = convert(s, 2) self.assertEquals(expected, actual)
def test_if_three_row_return_correct_result(self): s = "PAYPALISHIRING" expected = "PAHNAPLSIIGYIR" actual = convert(s, 3) self.assertEquals(expected, actual)
def test_if_two_row_return_correct_result(self): s = "TESTMYTEST" expected = "TSMTSETYET" actual = convert(s, 2) self.assertEquals(expected, actual)