Skip to content

Commit 3e020fd

Browse files
committed
test: verify insertion sort ignores labels when ordering
1 parent e9bd466 commit 3e020fd

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎sorts/insertion_sort.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ def insertion_sort[T: Comparable](collection: MutableSequence[T]) -> MutableSequ
6767
>>> insertion_sort(items) # doctest: +NORMALIZE_WHITESPACE
6868
[Item(priority=1, label='X'), Item(priority=1, label='Y'),
6969
Item(priority=2, label='A'), Item(priority=2, label='B')]
70+
>>> other = [Item(2, "B"), Item(1, "Y"), Item(2, "A"), Item(1, "X")]
71+
>>> insertion_sort(other) # doctest: +NORMALIZE_WHITESPACE
72+
[Item(priority=1, label='Y'), Item(priority=1, label='X'),
73+
Item(priority=2, label='B'), Item(priority=2, label='A')]
7074
7175
>>> import random
7276
>>> collection = random.sample(range(-50, 50), 100)

0 commit comments

Comments
 (0)