MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_fk_copy

Method test_fk_copy

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

Source from the content-addressed store, hash-verified

244 )
245
246 def test_fk_copy(self):
247 c1 = Column("foo", Integer)
248 c2 = Column("bar", Integer)
249 m = MetaData()
250 t1 = Table("t", m, c1, c2)
251
252 kw = dict(
253 onupdate="X",
254 ondelete="Y",
255 use_alter=True,
256 name="f1",
257 deferrable="Z",
258 initially="Q",
259 link_to_name=True,
260 comment="foo",
261 )
262
263 fk1 = ForeignKey(c1, **kw)
264 fk2 = ForeignKeyConstraint((c1,), (c2,), **kw)
265
266 t1.append_constraint(fk2)
267 fk1c = fk1._copy()
268 fk2c = fk2._copy()
269
270 for k in kw:
271 eq_(getattr(fk1c, k), kw[k])
272 eq_(getattr(fk2c, k), kw[k])
273
274 def test_check_constraint_copy(self):
275 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