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')
def test_remove_characters(self, mock_stdout): data = ["cool@#$!*"] transpose(string_list=data) self.assertEqual(mock_stdout.getvalue(), 'Original: cool\nTransposed: looc\n\n')
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')
def test_empty_list(self): data = [] with self.assertRaises(SystemExit) as cm: transpose(string_list=data) self.assertEqual(cm.exception.code, 1)
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')
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')
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')
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'])
def test_transpose(self): self.assertEqual(main.transpose([[1, 2, 3, 4], [5, 6, 7, 8]]), [[1, 5], [2, 6], [3, 7], [4, 8]])