def testIsSortedAsc(self): self.assertTrue(quick_sort.is_sorted_asc(self.sorted_collection_asc)) self.assertFalse(quick_sort.is_sorted_asc(self.shuffled_collection)) self.assertFalse(self.sorted_collection_asc.reverse()) self.assertTrue(quick_sort.is_sorted_asc([1])) self.assertTrue(quick_sort.is_sorted_asc([])) self.assertRaises(TypeError, quick_sort.is_sorted_asc, None )
def testMyQuicksort(self): old_collection = self.collection self.collection = quick_sort.my_quick_sort( self.collection ) self.assertTrue(quick_sort.is_sorted_asc(self.collection), 'collection is not sorted') self.assertCountEqual(old_collection, self.collection)