def test_selection_sort_mixed(self):
     test_list = [3, 2.2, True]
     expected = [True, 2.2, 3]
     self.assertEqual(expected, selection_sort(test_list))
 def test_selection_sort_floats(self):
     test_list = [3.3, 1.1, 2.2]
     expected = [1.1, 2.2, 3.3]
     self.assertEqual(expected, selection_sort(test_list))
 def test_selection_sort_booleans(self):
     test_list = [False, True, False]
     expected = [False, False, True]
     self.assertEqual(expected, selection_sort(test_list))
 def test_selection_sort_strings(self):
     test_list = ['bae', 'Bae', 'xX', 'bAe']
     expected = ['Bae', 'bAe', 'bae', 'xX']
     self.assertEqual(expected, selection_sort(test_list))
 def test_selection_sort_integers(self):
     test_list = [3, 1, 2, 0]
     expected = [0, 1, 2, 3]
     self.assertEqual(expected, selection_sort(test_list))
 def test_selection_sort_1_element(self):
     test_list = [0]
     expected = [0]
     self.assertEqual(expected, selection_sort(test_list))
Esempio n. 7
0
 def test_selection_sort(self):
     self.assertEqual(selection_sort([3, 5, 1, 9, -4]), [-4, 3, 1, 5, 9])
Esempio n. 8
0
 def test_invalid_arguments(self, mock_stdout):
     expected_output = 'The given argument is not a sortable list!\n'
     selection_sort('a')
     self.assertEqual(mock_stdout.getvalue(), expected_output)