(self)
| 265 | self.assertEqual(data, list(range(99,-1,-1))) |
| 266 | |
| 267 | def test_reverse_stability(self): |
| 268 | data = [(random.randrange(100), i) for i in range(200)] |
| 269 | copy1 = data[:] |
| 270 | copy2 = data[:] |
| 271 | def my_cmp(x, y): |
| 272 | x0, y0 = x[0], y[0] |
| 273 | return (x0 > y0) - (x0 < y0) |
| 274 | def my_cmp_reversed(x, y): |
| 275 | x0, y0 = x[0], y[0] |
| 276 | return (y0 > x0) - (y0 < x0) |
| 277 | data.sort(key=cmp_to_key(my_cmp), reverse=True) |
| 278 | copy1.sort(key=cmp_to_key(my_cmp_reversed)) |
| 279 | self.assertEqual(data, copy1) |
| 280 | copy2.sort(key=lambda x: x[0], reverse=True) |
| 281 | self.assertEqual(data, copy2) |
| 282 | |
| 283 | #============================================================================== |
| 284 | def check_against_PyObject_RichCompareBool(self, L): |
nothing calls this directly
no test coverage detected