diff --git a/sorting_searching/quick_sort/quick_sort_challenge.ipynb b/sorting_searching/quick_sort/quick_sort_challenge.ipynb index 65e04c9..5f9d6eb 100644 --- a/sorting_searching/quick_sort/quick_sort_challenge.ipynb +++ b/sorting_searching/quick_sort/quick_sort_challenge.ipynb @@ -105,18 +105,18 @@ " def test_quick_sort(self, func):\n", " print('Empty input')\n", " data = []\n", - " func(data)\n", - " assert_equal(data, [])\n", + " sorted_data = func(data)\n", + " assert_equal(sorted_data, [])\n", "\n", " print('One element')\n", " data = [5]\n", - " func(data)\n", - " assert_equal(data, [5])\n", + " sorted_data = func(data)\n", + " assert_equal(sorted_data, [5])\n", "\n", " print('Two or more elements')\n", " data = [5, 1, 7, 2, 6, -3, 5, 7, -1]\n", - " data = func(data)\n", - " assert_equal(data, sorted(data))\n", + " sorted_data = func(data)\n", + " assert_equal(sorted_data, sorted(data))\n", "\n", " print('Success: test_quick_sort\\n')\n", "\n", diff --git a/sorting_searching/quick_sort/quick_sort_solution.ipynb b/sorting_searching/quick_sort/quick_sort_solution.ipynb index e06db1f..8e0d8f8 100644 --- a/sorting_searching/quick_sort/quick_sort_solution.ipynb +++ b/sorting_searching/quick_sort/quick_sort_solution.ipynb @@ -169,18 +169,18 @@ " def test_quick_sort(self, func):\n", " print('Empty input')\n", " data = []\n", - " func(data)\n", - " assert_equal(data, [])\n", + " sorted_data = func(data)\n", + " assert_equal(sorted_data, [])\n", "\n", " print('One element')\n", " data = [5]\n", - " func(data)\n", - " assert_equal(data, [5])\n", + " sorted_data = func(data)\n", + " assert_equal(sorted_data, [5])\n", "\n", " print('Two or more elements')\n", " data = [5, 1, 7, 2, 6, -3, 5, 7, -1]\n", - " data = func(data)\n", - " assert_equal(data, sorted(data))\n", + " sorted_data = func(data)\n", + " assert_equal(sorted_data, sorted(data))\n", "\n", " print('Success: test_quick_sort\\n')\n", "\n", diff --git a/sorting_searching/quick_sort/test_quick_sort.py b/sorting_searching/quick_sort/test_quick_sort.py index 3da236d..691a75a 100644 --- a/sorting_searching/quick_sort/test_quick_sort.py +++ b/sorting_searching/quick_sort/test_quick_sort.py @@ -5,18 +5,18 @@ class TestQuickSort(object): def test_quick_sort(self, func): print('Empty input') data = [] - func(data) - assert_equal(data, []) + sorted_data = func(data) + assert_equal(sorted_data, []) print('One element') data = [5] - func(data) - assert_equal(data, [5]) + sorted_data = func(data) + assert_equal(sorted_data, [5]) print('Two or more elements') data = [5, 1, 7, 2, 6, -3, 5, 7, -1] - data = func(data) - assert_equal(data, sorted(data)) + sorted_data = func(data) + assert_equal(sorted_data, sorted(data)) print('Success: test_quick_sort\n')