Skip to content

Commit fb2f47b

Browse files
committed
Add doctests for duplicate and sorted inputs in bubble sort
1 parent 3c88735 commit fb2f47b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

sorts/bubble_sort.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ def bubble_sort_iterative(collection: list[Any]) -> list[Any]:
1717
[-45, -5, -2]
1818
>>> bubble_sort_iterative([-23, 0, 6, -4, 34])
1919
[-23, -4, 0, 6, 34]
20+
>>> bubble_sort_iterative([1, 2, 3, 4])
21+
[1, 2, 3, 4]
22+
>>> bubble_sort_iterative([3, 3, 3, 3])
23+
[3, 3, 3, 3]
24+
>>> bubble_sort_iterative([56])
25+
[56]
2026
>>> bubble_sort_iterative([0, 5, 2, 3, 2]) == sorted([0, 5, 2, 3, 2])
2127
True
2228
>>> bubble_sort_iterative([]) == sorted([])

0 commit comments

Comments
 (0)