Commit 9252e113 authored by Thomas Torsney-Weir's avatar Thomas Torsney-Weir

adjust sorting tests so it works if people change the list itself

parent 5c390f78
...@@ -13,17 +13,17 @@ def is_sorted(l): ...@@ -13,17 +13,17 @@ def is_sorted(l):
def test_simple_sort(): def test_simple_sort():
l = [3, 6, 1, 4] l = [3, 6, 1, 4]
l_sorted = [1, 3, 4, 6] l_sorted = [1, 3, 4, 6]
assert l1p1.sort_list(l) == l_sorted assert l1p1.sort_list(l.copy()) == l_sorted
def test_already_sorted(): def test_already_sorted():
l = [1, 2, 3, 4, 5] l = [1, 2, 3, 4, 5]
assert l1p1.sort_list(l) == l assert l1p1.sort_list(l.copy()) == l
def test_reverse_sorted(): def test_reverse_sorted():
l = [5, 4, 3, 2, 1] l = [5, 4, 3, 2, 1]
assert l1p1.sort_list(l) == list(reversed(l)) assert l1p1.sort_list(l.copy()) == list(reversed(l))
@given(st.lists(st.integers())) @given(st.lists(st.integers()))
def test_random_lists(l): def test_random_lists(l):
assert is_sorted(l1p1.sort_list(l)) assert is_sorted(l1p1.sort_list(l.copy()))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment