예제 #1
0
 def test_wrong(self):
   with self.assertRaises(Exception):
     sort(same, 'desc')
   with self.assertRaises(Exception):
     sort(same, 'ascending')
   with self.assertRaises(Exception):
     sort(same, 'descending')
   with self.assertRaises(Exception):
     sort(same, 'DESC')
   with self.assertRaises(Exception):
     sort(same, 'DES')
   with self.assertRaises(Exception):
     sort(same, 'ASC')
예제 #2
0
import stalinsort
print(stalinsort.sort([1, 2, 3, 2, 3, 2, 3, 4, 5, 6]))
예제 #3
0
 def test_repeated(self):
   self.assertListEqual(sort(same, 'des'), same)
예제 #4
0
 def test_right(self):
   self.assertListEqual(sort(same, 'asc'), same)
   self.assertListEqual(sort(same, 'des'), same)
예제 #5
0
 def test_reversed(self):
   self.assertListEqual(sort(reversed, 'des'), reversed)
예제 #6
0
 def test_almost_sorted(self):
   self.assertListEqual(sort(almost_sorted, 'des'), [0])
   self.assertListEqual(sort(almost_sorted0, 'des'), [0, -1])
예제 #7
0
 def test_empty(self):
   self.assertListEqual(sort([], 'des'), [])
예제 #8
0
 def test_sorted(self):
   self.assertListEqual(sort(sorted, 'des'), [0])
예제 #9
0
 def test_almost_sorted(self):
   self.assertListEqual(sort(almost_sorted), [0, 1, 4])
   self.assertListEqual(sort(almost_sorted0), [0, 2, 4, 7])
예제 #10
0
 def test_reversed(self):
   self.assertListEqual(sort(reversed), [3])
예제 #11
0
 def test_sorted(self):
   self.assertListEqual(sort(sorted), sorted)