Source code for sqlobject.tests.test_inheritance

from sqlobject import SQLObject, StringCol
from sqlobject.tests.dbtest import setupClass


########################################
# Inheritance
########################################


[docs]class Super(SQLObject): name = StringCol(length=10)
[docs]class Sub(Super): name2 = StringCol(length=10)
[docs]def test_super(): setupClass(Super) setupClass(Sub) s1 = Super(name='one') Super(name='two') # s2 s3 = Super.get(s1.id) assert s1 == s3
[docs]def test_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