(self)
| 170 | self.assertRaises(ValueError, L.sort) |
| 171 | |
| 172 | def test_undetected_mutation(self): |
| 173 | # Python 2.4a1 did not always detect mutation |
| 174 | memorywaster = [] |
| 175 | for i in range(20): |
| 176 | def mutating_cmp(x, y): |
| 177 | L.append(3) |
| 178 | L.pop() |
| 179 | return (x > y) - (x < y) |
| 180 | L = [1,2] |
| 181 | self.assertRaises(ValueError, L.sort, key=cmp_to_key(mutating_cmp)) |
| 182 | def mutating_cmp(x, y): |
| 183 | L.append(3) |
| 184 | del L[:] |
| 185 | return (x > y) - (x < y) |
| 186 | self.assertRaises(ValueError, L.sort, key=cmp_to_key(mutating_cmp)) |
| 187 | memorywaster = [memorywaster] |
| 188 | |
| 189 | #============================================================================== |
| 190 |
nothing calls this directly
no test coverage detected