Esempio n. 1
0
 def test_empty_string(self, mock_stdout):
     data = [""]
     transpose(string_list=data)
     self.assertEqual(
         mock_stdout.getvalue(),
         'There is only empty strings. Try to use another file.\n\n')
Esempio n. 2
0
 def test_remove_characters(self, mock_stdout):
     data = ["cool@#$!*"]
     transpose(string_list=data)
     self.assertEqual(mock_stdout.getvalue(),
                      'Original: cool\nTransposed: looc\n\n')
Esempio n. 3
0
 def test_we_get_only_one_word(self, mock_stdout):
     data = ["cool"]
     transpose(string_list=data)
     self.assertEqual(mock_stdout.getvalue(),
                      'Original: cool\nTransposed: looc\n\n')
Esempio n. 4
0
 def test_empty_list(self):
     data = []
     with self.assertRaises(SystemExit) as cm:
         transpose(string_list=data)
     self.assertEqual(cm.exception.code, 1)
Esempio n. 5
0
 def test_we_get_longest_transposed_word(self, mock_stdout):
     transpose(string_list=self.raw_data)
     self.assertEqual(
         mock_stdout.getvalue(),
         'Original: Sierra_Nevada\nTransposed: adaveN_arreiS\n\n')
Esempio n. 6
0
 def test_remove_spaces(self, mock_stdout):
     data = [" Sierra - Nevada "]
     transpose(string_list=data)
     self.assertEqual(mock_stdout.getvalue(),
                      'Original: Sierra\nTransposed: arreiS\n\n')
Esempio n. 7
0
 def test_remove_digits(self, mock_stdout):
     data = ["346 cool6"]
     transpose(string_list=data)
     self.assertEqual(mock_stdout.getvalue(),
                      'Original: cool\nTransposed: looc\n\n')
Esempio n. 8
0
 def test_transpose(self):
     self.assertEqual(main.transpose(['a']), ['a'])
     self.assertEqual(main.transpose(['a', 'b']), ['ab'])
     self.assertEqual(main.transpose(['ab', '12']), ['a1', 'b2'])
Esempio n. 9
0
 def test_transpose(self):
     self.assertEqual(main.transpose([[1, 2, 3, 4], [5, 6, 7, 8]]),
                      [[1, 5], [2, 6], [3, 7], [4, 8]])