MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_col_key_fk_parent

Method test_col_key_fk_parent

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

Source from the content-addressed store, hash-verified

1046 eq_(table3_c.c.foo.comment, "some column")
1047
1048 def test_col_key_fk_parent(self):
1049 # test #2643
1050 m1 = MetaData()
1051 a = Table("a", m1, Column("x", Integer))
1052 b = Table("b", m1, Column("x", Integer, ForeignKey("a.x"), key="y"))
1053 assert b.c.y.references(a.c.x)
1054
1055 m2 = MetaData()
1056 b2 = b.to_metadata(m2)
1057 a2 = a.to_metadata(m2)
1058 assert b2.c.y.references(a2.c.x)
1059
1060 def test_fk_w_no_colname(self):
1061 """test a ForeignKey that refers to table name only. the column

Callers

nothing calls this directly

Calls 6

to_metadataMethod · 0.95
MetaDataClass · 0.90
TableClass · 0.90
ColumnClass · 0.90
ForeignKeyClass · 0.90
referencesMethod · 0.45

Tested by

no test coverage detected