def test_sort_long_list_with_odd_nubmers(self): """Sorts a long list of integers with odd numbers in it""" result = sort_array([6, 3, 8, 1, 6, 34, 2, 98, 234, 2, 0, 19, 3, 5]) self.assertEqual(result, [6, 1, 8, 3, 6, 34, 2, 98, 234, 2, 0, 3, 5, 19])
def test_does_not_sort_all_even(self): """Does not modify or sort a list of all even numbers""" result = sort_array([4, 6, 2, 4, 10]) self.assertEqual(result, [4, 6, 2, 4, 10])
def test_sort_short_list_with_odd_numbers(self): """Sorts a short list of integers with odd numbers in it""" result = sort_array([4, 5, 2, 7, 3, 1, 10, 9]) self.assertEqual(result, [4, 1, 2, 3, 5, 7, 10, 9])
def test_returns_empty_list_if_arg_is_empty_list(self): """Returns an empty list if the argument is an empty list""" result = sort_array([]) self.assertEqual(result, [])
def test_sort_all_odd(self): """Sorts a list of all odd numbers""" result = sort_array([1, 3, 7, 5, 9]) self.assertEqual(result, [1, 3, 5, 7, 9])
def result(): return sort_array("test")
def test_sort_array(input, output): from sort_the_odd import sort_array assert sort_array(input) == output
def test_sort_odds(): array = [5, 3, 1] result = [1, 3, 5] assert sort_array(array) == result
def test_empty_array(): array = [] result = [] assert sort_array(array) == result
def test_sort_odds_and_leave_pairs(): array = [5, 3, 2, 8, 1, 4] result = [1, 3, 2, 8, 5, 4] assert sort_array(array) == result