mirror of
https://github.com/TheAlgorithms/Python.git
synced 2026-03-13 09:50:19 +08:00
Add doctests for duplicate and sorted inputs in bubble sort (#14154)
Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
This commit is contained in:
@@ -17,6 +17,12 @@ def bubble_sort_iterative(collection: list[Any]) -> list[Any]:
|
||||
[-45, -5, -2]
|
||||
>>> bubble_sort_iterative([-23, 0, 6, -4, 34])
|
||||
[-23, -4, 0, 6, 34]
|
||||
>>> bubble_sort_iterative([1, 2, 3, 4])
|
||||
[1, 2, 3, 4]
|
||||
>>> bubble_sort_iterative([3, 3, 3, 3])
|
||||
[3, 3, 3, 3]
|
||||
>>> bubble_sort_iterative([56])
|
||||
[56]
|
||||
>>> bubble_sort_iterative([0, 5, 2, 3, 2]) == sorted([0, 5, 2, 3, 2])
|
||||
True
|
||||
>>> bubble_sort_iterative([]) == sorted([])
|
||||
|
||||
Reference in New Issue
Block a user