(self, connection, metadata)
| 1305 | ) |
| 1306 | |
| 1307 | def test_index_reflection(self, connection, metadata): |
| 1308 | m1 = metadata |
| 1309 | t1 = Table( |
| 1310 | "party", |
| 1311 | m1, |
| 1312 | Column("id", sa.Integer, nullable=False), |
| 1313 | Column("name", sa.String(20), index=True), |
| 1314 | ) |
| 1315 | sa.Index("idx1", t1.c.id, unique=True) |
| 1316 | sa.Index("idx2", t1.c.name, t1.c.id, unique=False) |
| 1317 | m1.create_all(connection) |
| 1318 | m2 = MetaData() |
| 1319 | t2 = Table("party", m2, autoload_with=connection) |
| 1320 | |
| 1321 | assert len(t2.indexes) == 3 |
| 1322 | # Make sure indexes are in the order we expect them in |
| 1323 | tmp = [(idx.name, idx) for idx in t2.indexes] |
| 1324 | tmp.sort() |
| 1325 | r1, r2, r3 = (idx[1] for idx in tmp) |
| 1326 | |
| 1327 | assert r1.name == "idx1" |
| 1328 | assert r2.name == "idx2" |
| 1329 | assert r1.unique == True # noqa |
| 1330 | assert r2.unique == False # noqa |
| 1331 | assert r3.unique == False # noqa |
| 1332 | assert {t2.c.id} == set(r1.columns) |
| 1333 | assert {t2.c.name, t2.c.id} == set(r2.columns) |
| 1334 | assert {t2.c.name} == set(r3.columns) |
| 1335 | |
| 1336 | @testing.requires.comment_reflection |
| 1337 | def test_comment_reflection(self, connection, metadata): |
nothing calls this directly
no test coverage detected