(self)
| 1409 | self._assert_collection_integrity(cc) |
| 1410 | |
| 1411 | def test_remove(self): |
| 1412 | c1, c2, c3 = column("c1"), column("c2"), column("c3") |
| 1413 | |
| 1414 | cc = DedupeColumnCollection( |
| 1415 | columns=[("c1", c1), ("c2", c2), ("c3", c3)] |
| 1416 | ) |
| 1417 | ci = cc.as_readonly() |
| 1418 | |
| 1419 | eq_(cc._all_columns, [c1, c2, c3]) |
| 1420 | eq_(list(cc), [c1, c2, c3]) |
| 1421 | assert cc.contains_column(c2) |
| 1422 | assert "c2" in cc |
| 1423 | |
| 1424 | eq_(ci._all_columns, [c1, c2, c3]) |
| 1425 | eq_(list(ci), [c1, c2, c3]) |
| 1426 | assert ci.contains_column(c2) |
| 1427 | assert "c2" in ci |
| 1428 | |
| 1429 | cc.remove(c2) |
| 1430 | |
| 1431 | eq_(cc._all_columns, [c1, c3]) |
| 1432 | eq_(list(cc), [c1, c3]) |
| 1433 | is_(cc[0], c1) |
| 1434 | is_(cc[1], c3) |
| 1435 | assert not cc.contains_column(c2) |
| 1436 | assert "c2" not in cc |
| 1437 | self._assert_collection_integrity(cc) |
| 1438 | |
| 1439 | eq_(ci._all_columns, [c1, c3]) |
| 1440 | eq_(list(ci), [c1, c3]) |
| 1441 | is_(ci[0], c1) |
| 1442 | is_(ci[1], c3) |
| 1443 | assert not ci.contains_column(c2) |
| 1444 | assert "c2" not in ci |
| 1445 | |
| 1446 | assert_raises(IndexError, lambda: ci[2]) |
| 1447 | |
| 1448 | def test_remove_doesnt_change_iteration(self): |
| 1449 | c1, c2, c3, c4, c5 = ( |
nothing calls this directly
no test coverage detected