(self, registry)
| 3572 | """test that local-remote is correctly determined for m2m""" |
| 3573 | |
| 3574 | def test_local_remote(self, registry): |
| 3575 | meta = MetaData() |
| 3576 | |
| 3577 | t1 = Table("t1", meta, Column("id", Integer, primary_key=True)) |
| 3578 | t2 = Table("t2", meta, Column("id", Integer, primary_key=True)) |
| 3579 | t12 = Table( |
| 3580 | "tab", |
| 3581 | meta, |
| 3582 | Column("t1_id", Integer, ForeignKey("t1.id")), |
| 3583 | Column("t2_id", Integer, ForeignKey("t2.id")), |
| 3584 | ) |
| 3585 | |
| 3586 | class A: |
| 3587 | pass |
| 3588 | |
| 3589 | class B: |
| 3590 | pass |
| 3591 | |
| 3592 | registry.map_imperatively(B, t2) |
| 3593 | m = registry.map_imperatively( |
| 3594 | A, |
| 3595 | t1, |
| 3596 | properties=dict( |
| 3597 | b_view=relationship(B, secondary=t12, viewonly=True), |
| 3598 | b_plain=relationship(B, secondary=t12), |
| 3599 | ), |
| 3600 | ) |
| 3601 | configure_mappers() |
| 3602 | assert ( |
| 3603 | m.get_property("b_view").local_remote_pairs |
| 3604 | == m.get_property("b_plain").local_remote_pairs |
| 3605 | == [(t1.c.id, t12.c.t1_id), (t2.c.id, t12.c.t2_id)] |
| 3606 | ) |
| 3607 | |
| 3608 | |
| 3609 | class ViewOnlyNonEquijoin(fixtures.MappedTest): |
nothing calls this directly
no test coverage detected