예제 #1
0
 def test_bubblesort__error_descending(self):
     list = [1, 4, 5.77, 2, "a"]
     with pytest.raises(TypeError):
         bubblesort(list, descending=True)
예제 #2
0
 def test_bubblesort__on_empty_list_descending(self):
     assert bubblesort([], descending=True) == []
예제 #3
0
 def test_bubblesort__on_single_float_descending(self):
     list = _create_list_of_floats(1)
     list_copy = list[:]
     assert bubblesort(list, descending=True) == sorted(list_copy,
                                                        reverse=True)
예제 #4
0
 def test_bubblesort__on_integers_descending(self):
     list = _create_list_of_integers(25)
     list_copy = list[:]
     assert bubblesort(list, descending=True) == sorted(list_copy,
                                                        reverse=True)
예제 #5
0
 def test_bubblesort__error(self):
     list = [1, 4, 5.77, 2, "a"]
     with pytest.raises(TypeError):
         bubblesort(list)
예제 #6
0
 def test_bubblesort__on_single_float(self):
     list = _create_list_of_floats(1)
     list_copy = list[:]
     assert bubblesort(list) == sorted(list_copy)
예제 #7
0
 def test_bubblesort__on_empty_list(self):
     assert bubblesort([]) == []
예제 #8
0
 def test_bubblesort__on_integers(self):
     list = _create_list_of_integers(25)
     list_copy = list[:]
     assert bubblesort(list) == sorted(list_copy)