MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_no_delete_PK_BtoA

Method test_no_delete_PK_BtoA

test/orm/test_relationships.py:1680–1705  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1678 )
1679
1680 def test_no_delete_PK_BtoA(self):
1681 tableB, A, B, tableA = (
1682 self.tables.tableB,
1683 self.classes.A,
1684 self.classes.B,
1685 self.tables.tableA,
1686 )
1687
1688 self.mapper_registry.map_imperatively(
1689 B, tableB, properties={"a": relationship(A, cascade="save-update")}
1690 )
1691 self.mapper_registry.map_imperatively(A, tableA)
1692
1693 b1 = B()
1694 a1 = A()
1695 b1.a = a1
1696 with fixture_session() as sess:
1697 sess.add(b1)
1698 sess.flush()
1699 b1.a = None
1700 assert_raises_message(
1701 AssertionError,
1702 "Dependency rule on column 'tableA.id' tried to blank-out "
1703 "primary key column 'tableB.id' on instance ",
1704 sess.flush,
1705 )
1706
1707 @testing.fails_on_everything_except(
1708 "sqlite", testing.requires.mysql_non_strict

Callers

nothing calls this directly

Calls 8

relationshipFunction · 0.90
fixture_sessionFunction · 0.90
assert_raises_messageFunction · 0.90
map_imperativelyMethod · 0.80
BClass · 0.70
AClass · 0.70
addMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected