Source code for sqlobject.tests.test_inheritance

fromsqlobjectimport SQLObject, StringCol
fromsqlobject.tests.dbtestimport setupClass
########################################
# Inheritance
########################################
[docs] classSuper(SQLObject): name = StringCol(length=10)
[docs] classSub(Super): name2 = StringCol(length=10)
[docs] deftest_super(): setupClass(Super) setupClass(Sub) s1 = Super(name='one') Super(name='two') # s2 s3 = Super.get(s1.id) assert s1 == s3
[docs] deftest_sub(): setupClass(Super) setupClass(Sub) s1 = Sub(name='one', name2='1') Sub(name='two', name2='2') # s2 s3 = Sub.get(s1.id) assert s1 == s3