(self)
| 1314 | self._assert_collection_integrity(cc) |
| 1315 | |
| 1316 | def test_remove(self): |
| 1317 | c1, c2, c3 = column("c1"), column("c2"), column("c3") |
| 1318 | |
| 1319 | cc = DedupeColumnCollection( |
| 1320 | columns=[("c1", c1), ("c2", c2), ("c3", c3)] |
| 1321 | ) |
| 1322 | ci = cc.as_readonly() |
| 1323 | |
| 1324 | eq_(cc._all_columns, [c1, c2, c3]) |
| 1325 | eq_(list(cc), [c1, c2, c3]) |
| 1326 | assert cc.contains_column(c2) |
| 1327 | assert "c2" in cc |
| 1328 | |
| 1329 | eq_(ci._all_columns, [c1, c2, c3]) |
| 1330 | eq_(list(ci), [c1, c2, c3]) |
| 1331 | assert ci.contains_column(c2) |
| 1332 | assert "c2" in ci |
| 1333 | |
| 1334 | cc.remove(c2) |
| 1335 | |
| 1336 | eq_(cc._all_columns, [c1, c3]) |
| 1337 | eq_(list(cc), [c1, c3]) |
| 1338 | is_(cc[0], c1) |
| 1339 | is_(cc[1], c3) |
| 1340 | assert not cc.contains_column(c2) |
| 1341 | assert "c2" not in cc |
| 1342 | self._assert_collection_integrity(cc) |
| 1343 | |
| 1344 | eq_(ci._all_columns, [c1, c3]) |
| 1345 | eq_(list(ci), [c1, c3]) |
| 1346 | is_(ci[0], c1) |
| 1347 | is_(ci[1], c3) |
| 1348 | assert not ci.contains_column(c2) |
| 1349 | assert "c2" not in ci |
| 1350 | |
| 1351 | assert_raises(IndexError, lambda: ci[2]) |
| 1352 | |
| 1353 | def test_remove_doesnt_change_iteration(self): |
| 1354 | c1, c2, c3, c4, c5 = ( |
nothing calls this directly
no test coverage detected