(cls)
| 29 | class _JoinFixtures: |
| 30 | @classmethod |
| 31 | def setup_test_class(cls): |
| 32 | m = MetaData() |
| 33 | cls.left = Table( |
| 34 | class="st">"lft", |
| 35 | m, |
| 36 | Column(class="st">"id", Integer, primary_key=True), |
| 37 | Column(class="st">"x", Integer), |
| 38 | Column(class="st">"y", Integer), |
| 39 | ) |
| 40 | |
| 41 | cls.right = Table( |
| 42 | class="st">"rgt", |
| 43 | m, |
| 44 | Column(class="st">"id", Integer, primary_key=True), |
| 45 | Column(class="st">"lid", Integer, ForeignKey(class="st">"lft.id")), |
| 46 | Column(class="st">"x", Integer), |
| 47 | Column(class="st">"y", Integer), |
| 48 | ) |
| 49 | |
| 50 | from sqlalchemy.orm import registry |
| 51 | |
| 52 | reg = registry() |
| 53 | |
| 54 | cls.relationship = relationship(class="st">"Otherwise") |
| 55 | |
| 56 | @reg.mapped |
| 57 | class Whatever: |
| 58 | __table__ = cls.left |
| 59 | |
| 60 | foo = cls.relationship |
| 61 | |
| 62 | @reg.mapped |
| 63 | class Otherwise: |
| 64 | __table__ = cls.right |
| 65 | |
| 66 | reg.configure() |
| 67 | |
| 68 | cls.right_multi_fk = Table( |
| 69 | class="st">"rgt_multi_fk", |
| 70 | m, |
| 71 | Column(class="st">"id", Integer, primary_key=True), |
| 72 | Column(class="st">"lid1", Integer, ForeignKey(class="st">"lft.id")), |
| 73 | Column(class="st">"lid2", Integer, ForeignKey(class="st">"lft.id")), |
| 74 | ) |
| 75 | |
| 76 | cls.selfref = Table( |
| 77 | class="st">"selfref", |
| 78 | m, |
| 79 | Column(class="st">"id", Integer, primary_key=True), |
| 80 | Column(class="st">"sid", Integer, ForeignKey(class="st">"selfref.id")), |
| 81 | ) |
| 82 | cls.composite_selfref = Table( |
| 83 | class="st">"composite_selfref", |
| 84 | m, |
| 85 | Column(class="st">"id", Integer, primary_key=True), |
| 86 | Column(class="st">"group_id", Integer, primary_key=True), |
| 87 | Column(class="st">"parent_id", Integer), |
| 88 | ForeignKeyConstraint( |
nothing calls this directly
no test coverage detected