(self)
| 1473 | self._assert_collection_integrity(cc) |
| 1474 | |
| 1475 | def test_dupes_extend(self): |
| 1476 | cc = DedupeColumnCollection() |
| 1477 | ci = cc.as_readonly() |
| 1478 | |
| 1479 | c1, c2a, c3, c2b = ( |
| 1480 | column("c1"), |
| 1481 | column("c2"), |
| 1482 | column("c3"), |
| 1483 | column("c2"), |
| 1484 | ) |
| 1485 | |
| 1486 | cc.add(c1) |
| 1487 | cc.add(c2a) |
| 1488 | |
| 1489 | cc.extend([c3, c2b]) # this should remove c2a |
| 1490 | |
| 1491 | eq_(cc._all_columns, [c1, c2b, c3]) |
| 1492 | eq_(list(cc), [c1, c2b, c3]) |
| 1493 | is_(cc[1], c2b) |
| 1494 | is_(cc[2], c3) |
| 1495 | assert_raises(IndexError, lambda: cc[3]) |
| 1496 | self._assert_collection_integrity(cc) |
| 1497 | |
| 1498 | assert not cc.contains_column(c2a) |
| 1499 | assert cc.contains_column(c2b) |
| 1500 | |
| 1501 | eq_(ci._all_columns, [c1, c2b, c3]) |
| 1502 | eq_(list(ci), [c1, c2b, c3]) |
| 1503 | is_(ci[1], c2b) |
| 1504 | is_(ci[2], c3) |
| 1505 | assert_raises(IndexError, lambda: ci[3]) |
| 1506 | |
| 1507 | assert not ci.contains_column(c2a) |
| 1508 | assert ci.contains_column(c2b) |
| 1509 | |
| 1510 | def test_extend_existing_maintains_ordering(self): |
| 1511 | cc = DedupeColumnCollection() |
nothing calls this directly
no test coverage detected