MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / test_replace

Method test_replace

test/base/test_utils.py:1148–1175  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1146 eq_(list(ci), [c1, c2, c3])
1147
1148 def test_replace(self):
1149 cc = DedupeColumnCollection()
1150 ci = cc.as_readonly()
1151
1152 c1, c2a, c3, c2b = (
1153 column("c1"),
1154 column("c2"),
1155 column("c3"),
1156 column("c2"),
1157 )
1158
1159 cc.add(c1)
1160 cc.add(c2a)
1161 cc.add(c3)
1162
1163 cc.replace(c2b)
1164
1165 eq_(cc._all_columns, [c1, c2b, c3])
1166 eq_(list(cc), [c1, c2b, c3])
1167 is_(cc[1], c2b)
1168
1169 assert not cc.contains_column(c2a)
1170 assert cc.contains_column(c2b)
1171 self._assert_collection_integrity(cc)
1172
1173 eq_(ci._all_columns, [c1, c2b, c3])
1174 eq_(list(ci), [c1, c2b, c3])
1175 is_(ci[1], c2b)
1176
1177 def test_replace_key_matches_name_of_another(self):
1178 cc = DedupeColumnCollection()

Callers

nothing calls this directly

Calls 9

addMethod · 0.95
replaceMethod · 0.95
columnFunction · 0.90
eq_Function · 0.90
is_Function · 0.90
as_readonlyMethod · 0.45
contains_columnMethod · 0.45

Tested by

no test coverage detected