Exemple #1
0
 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)
Exemple #2
0
def test_convert():
    assert convert('PAYPALISHIRING', 3) == 'PAHNAPLSIIGYIR'
    assert convert('PAYPALISHIRING', 4) == 'PINALSIGYAHRPI'
    assert convert('PAYPALISHIRING', 1) == 'PAYPALISHIRING'
Exemple #3
0
 def test_example1(self):
     input = "PAYPALISHIRING"
     output = 'PAHNAPLSIIGYIR'
     self.assertEqual(convert(input, 3), output)
Exemple #4
0
 def test_large_n(self):
     input = 'abcde'
     self.assertEqual(convert(input, 6), input)
     input = 'abcdefabcdefabcdefabcdef'
     output = 'acbbdcaedffeefdacbbcadfe'
     self.assertEqual(convert(input, 11), output)
Exemple #5
0
 def test_capitals(self):
     input = 'ABCdefG'
     output = 'AeBdfCG'
     self.assertEqual(convert(input, 3), output)
Exemple #6
0
 def test_spaces(self):
     input = 'ab cdef'
     output = 'adbce f'
     self.assertEqual(convert(input, 3), output)
Exemple #7
0
 def test_example2(self):
     input = 'PAYPALISHIRING'
     output = 'PINALSIGYAHRPI'
     self.assertEqual(convert(input, 4), output)
Exemple #8
0
    def test_if_one_row_return_same_list(self):
        s = "TEST1TOTEST"
        actual = convert(s, 1)

        self.assertEquals(s, actual)
Exemple #9
0
    def test_weird_case(self):
        s = "A"
        expected = "A"
        actual = convert(s, 2)

        self.assertEquals(expected, actual)
Exemple #10
0
    def test_if_three_row_return_correct_result(self):
        s = "PAYPALISHIRING"
        expected = "PAHNAPLSIIGYIR"
        actual = convert(s, 3)

        self.assertEquals(expected, actual)
Exemple #11
0
    def test_if_two_row_return_correct_result(self):
        s = "TESTMYTEST"
        expected = "TSMTSETYET"
        actual = convert(s, 2)

        self.assertEquals(expected, actual)