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

Method test_fk_copy

test/sql/test_metadata.py:240–266  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

238 )
239
240 def test_fk_copy(self):
241 c1 = Column("foo", Integer)
242 c2 = Column("bar", Integer)
243 m = MetaData()
244 t1 = Table("t", m, c1, c2)
245
246 kw = dict(
247 onupdate="X",
248 ondelete="Y",
249 use_alter=True,
250 name="f1",
251 deferrable="Z",
252 initially="Q",
253 link_to_name=True,
254 comment="foo",
255 )
256
257 fk1 = ForeignKey(c1, **kw)
258 fk2 = ForeignKeyConstraint((c1,), (c2,), **kw)
259
260 t1.append_constraint(fk2)
261 fk1c = fk1._copy()
262 fk2c = fk2._copy()
263
264 for k in kw:
265 eq_(getattr(fk1c, k), kw[k])
266 eq_(getattr(fk2c, k), kw[k])
267
268 def test_check_constraint_copy(self):
269 def r(x):

Callers

nothing calls this directly

Calls 9

append_constraintMethod · 0.95
_copyMethod · 0.95
_copyMethod · 0.95
ColumnClass · 0.90
MetaDataClass · 0.90
TableClass · 0.90
ForeignKeyClass · 0.90
eq_Function · 0.90

Tested by

no test coverage detected