コード例 #1
0
 def testExceededChunksLimit(self):
     buffer_size = 10
     data = xrange(MAX_CHUNKS * buffer_size + 1)
     self.assertTrue(sort(data), "Creating iterator wont raise error")
     with self.assertRaises(MemoryError):
         list(sort(data, buffer_size=buffer_size))
コード例 #2
0
 def testTenKRepeatingData(self):
     data = [i % 100 for i in range(10000)]
     expected_data = sorted(data)
     self.assertListEqual(expected_data, list(sort(data)))
コード例 #3
0
 def testDifferentKey(self):
     assert list(reversed(DATA_SORTED)) == list(sort(DATA, key=lambda i: -i))
     self.assertListEqual(DATA_STRINGS_SORTED_ON_LEN, list(sort(DATA_STRINGS, key=lambda s: len(s))))
コード例 #4
0
 def testLargerBuffer(self):
     self.assertListEqual(DATA_SORTED, list(sort(DATA, buffer_size=len(DATA) + 10)))
コード例 #5
0
 def testSmallerBuffer(self):
     self.assertListEqual(DATA_SORTED, list(sort(DATA, buffer_size=3)))
     self.assertListEqual(DATA_SORTED, list(sort(DATA, buffer_size=len(DATA) - 1)))
コード例 #6
0
 def testBasic(self):
     self.assertListEqual(DATA_SORTED, list(sort(DATA, buffer_size=len(DATA))))