Exemplo n.º 1
0
 def test_selection_sort_type(self):
     self.assertIsInstance(selection_sort(["c", "b", "a"]), list)
Exemplo n.º 2
0
 def test_selection_sort_empty(self):
     with self.assertRaises(ValueError):
         selection_sort([])
Exemplo n.º 3
0
 def test_selection_sort_str(self):
     self.assertEqual(selection_sort(["hello", "a", "bun"]), ["a", "bun", "hello"])
Exemplo n.º 4
0
 def test_selection_sort_multi_type(self):
     with self.assertRaises(TypeError):
         selection_sort(["a", 10, "de"])
Exemplo n.º 5
0
 def test_selection_sort_non_sortable_items(self):
     with self.assertRaises(ValueError):
         selection_sort(['a', 2, 3.14, 'the'])
Exemplo n.º 6
0
 def test_selection_sort_ints(self):
     self.assertEqual(selection_sort([9, 100, 0, 2]), [0, 2, 9, 100])
 def test_selection_sort_empty_list(self):
     with self.assertRaises(ValueError):
         q04.selection_sort([])
 def test_selection_sort_string(self):
     self.assertEqual(sorted(['c', 'h', 'r', 'i', 's']),
                      q04.selection_sort(['c', 'h', 'r', 'i', 's']))
 def test_selection_sort_number(self):
     self.assertEqual(sorted([3, 5, 1, 9, -4]),
                      q04.selection_sort([3, 5, 1, 9, -4]))
 def test_selection_sort_return_length(self):
     self.assertEqual(5, len(q04.selection_sort([3, 5, 1, 9, -4])))
 def test_selection_sort_return_type(self):
     self.assertEqual(list, type(q04.selection_sort([3, 5, 1, 9, -4])))