Source code for sqlobject.inheritance.tests.test_destroy_cascade
from sqlobject import ForeignKey, IntCol, SQLObject
from sqlobject.inheritance import InheritableSQLObject
from sqlobject.tests.dbtest import setupClass
[docs]class SOTestCascade1(InheritableSQLObject):
dummy = IntCol()
[docs]class SOTestCascade2(SOTestCascade1):
c = ForeignKey('SOTestCascade3', cascade='null')
[docs]class SOTestCascade3(SQLObject):
dummy = IntCol()
[docs]def test_destroySelf():
setupClass([SOTestCascade1, SOTestCascade3, SOTestCascade2])
c = SOTestCascade3(dummy=1)
SOTestCascade2(cID=c.id, dummy=1)
c.destroySelf()