Source code for sqlobject.tests.test_sqlmeta_idName

from sqlobject import MixedCaseStyle, SQLObject, sqlmeta
from sqlobject.tests.dbtest import setupClass


[docs]class myid_sqlmeta(sqlmeta): idName = "my_id"
[docs]class SOTestSqlmeta1(SQLObject):
[docs] class sqlmeta(myid_sqlmeta): pass
[docs]class SOTestSqlmeta2(SQLObject):
[docs] class sqlmeta(sqlmeta): style = MixedCaseStyle(longID=True)
[docs]class SOTestSqlmeta3(SQLObject):
[docs] class sqlmeta(myid_sqlmeta): style = MixedCaseStyle(longID=True)
[docs]class SOTestSqlmeta4(SQLObject):
[docs] class sqlmeta(myid_sqlmeta): idName = None style = MixedCaseStyle(longID=True)
[docs]class longid_sqlmeta(sqlmeta): idName = "my_id" style = MixedCaseStyle(longID=True)
[docs]class SOTestSqlmeta5(SQLObject):
[docs] class sqlmeta(longid_sqlmeta): pass
[docs]class SOTestSqlmeta6(SQLObject):
[docs] class sqlmeta(longid_sqlmeta): idName = None
[docs]def test_sqlmeta_inherited_idName(): setupClass([SOTestSqlmeta1, SOTestSqlmeta2]) assert SOTestSqlmeta1.sqlmeta.idName == "my_id" assert SOTestSqlmeta2.sqlmeta.idName == "SOTestSqlmeta2ID" assert SOTestSqlmeta3.sqlmeta.idName == "my_id" assert SOTestSqlmeta4.sqlmeta.idName == "SOTestSqlmeta4ID" assert SOTestSqlmeta5.sqlmeta.idName == "my_id" assert SOTestSqlmeta6.sqlmeta.idName == "SOTestSqlmeta6ID"