[SQL-CVS] r623 - trunk/SQLObject/sqlobject/tests
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: <sub...@co...> - 2005-02-20 04:45:51
|
Author: ianb Date: 2005-02-20 04:45:46 +0000 (Sun, 20 Feb 2005) New Revision: 623 Added: trunk/SQLObject/sqlobject/tests/test_reparent_sqlmeta.py Log: Added test for the new softer inheritance requirements for sqlmeta Added: trunk/SQLObject/sqlobject/tests/test_reparent_sqlmeta.py =================================================================== --- trunk/SQLObject/sqlobject/tests/test_reparent_sqlmeta.py 2005-02-20 04:35:41 UTC (rev 622) +++ trunk/SQLObject/sqlobject/tests/test_reparent_sqlmeta.py 2005-02-20 04:45:46 UTC (rev 623) @@ -0,0 +1,30 @@ +from sqlobject import * +from sqlobject.tests.dbtest import * + +real_sqlmeta = sqlmeta + +class Reparented1(SQLObject): + + class sqlmeta: + table = 'reparented1' + + dummy = StringCol() + +class Reparented2(SQLObject): + class sqlmeta(object): + def setClass(cls, soClass): + # Well, it's pretty hard to call the superclass method + # when it's a classmethod and it's not actually your + # *current* superclass. Sigh + real_sqlmeta.setClass.im_func(cls, soClass) + cls.worked = True + setClass = classmethod(setClass) + + dummy = StringCol() + +def test_reparented(): + setupClass([Reparented1, Reparented2]) + assert Reparented1.sqlmeta.table == 'reparented1' + assert issubclass(Reparented1.sqlmeta, real_sqlmeta) + assert issubclass(Reparented2.sqlmeta, real_sqlmeta) + assert Reparented2.sqlmeta.worked |