| 859 | @testing.fixture |
| 860 | def one_to_one_fixture(self, registry, async_engine): |
| 861 | async def go(legacy_inactive_history_style): |
| 862 | @registry.mapped |
| 863 | class A: |
| 864 | __tablename__ = "a" |
| 865 | |
| 866 | id = Column( |
| 867 | Integer, primary_key=True, test_needs_autoincrement=True |
| 868 | ) |
| 869 | b = relationship( |
| 870 | "B", |
| 871 | uselist=False, |
| 872 | _legacy_inactive_history_style=( |
| 873 | legacy_inactive_history_style |
| 874 | ), |
| 875 | ) |
| 876 | |
| 877 | @registry.mapped |
| 878 | class B: |
| 879 | __tablename__ = "b" |
| 880 | id = Column( |
| 881 | Integer, primary_key=True, test_needs_autoincrement=True |
| 882 | ) |
| 883 | a_id = Column(ForeignKey("a.id")) |
| 884 | |
| 885 | async with async_engine.begin() as conn: |
| 886 | await conn.run_sync(registry.metadata.create_all) |
| 887 | |
| 888 | return A, B |
| 889 | |
| 890 | return go |
| 891 | |