There was an error while loading. Please reload this page.
1 parent a6d20ad commit ace0391Copy full SHA for ace0391
1 file changed
tests/test_sorts.py
@@ -128,3 +128,23 @@ def test_sort_matches_builtin(sort, case) -> None:
128
def test_sort_rejects_non_comparable_items(sort) -> None:
129
with pytest.raises(TypeError):
130
sort([1, "a"])
131
+import pytest
132
+from sorts.slowsort import slowsort
133
+
134
135
+def test_slowsort_comparable_types():
136
+ # Test with strings
137
+ words = ["banana", "apple", "cherry", "date"]
138
+ slowsort(words)
139
+ assert words == ["apple", "banana", "cherry", "date"]
140
141
+ # Test with floats and negative numbers
142
+ floats = [3.14, -1.0, 2.5, 0.0]
143
+ slowsort(floats)
144
+ assert floats == [-1.0, 0.0, 2.5, 3.14]
145
146
147
+def test_slowsort_type_error_on_incomparable():
148
+ mixed = [1, "a"]
149
+ with pytest.raises(TypeError):
150
+ slowsort(mixed)
0 commit comments