| 270 | eq_(str(o), "OrderedSet([3, 2, 4, 5])") |
| 271 | |
| 272 | def test_modify(self): |
| 273 | o = util.OrderedSet([3, 9, 11]) |
| 274 | is_none(o.add(42)) |
| 275 | in_(42, o) |
| 276 | in_(3, o) |
| 277 | |
| 278 | is_none(o.remove(9)) |
| 279 | not_in(9, o) |
| 280 | in_(3, o) |
| 281 | |
| 282 | is_none(o.discard(11)) |
| 283 | in_(3, o) |
| 284 | |
| 285 | o.add(99) |
| 286 | is_none(o.insert(1, 13)) |
| 287 | eq_(list(o), [3, 13, 42, 99]) |
| 288 | eq_(o[2], 42) |
| 289 | |
| 290 | val = o.pop() |
| 291 | eq_(val, 99) |
| 292 | not_in(99, o) |
| 293 | eq_(list(o), [3, 13, 42]) |
| 294 | |
| 295 | is_none(o.clear()) |
| 296 | not_in(3, o) |
| 297 | is_false(bool(o)) |
| 298 | |
| 299 | def test_empty_pop(self): |
| 300 | with expect_raises_message(KeyError, "pop from an empty set"): |