[SQL-CVS] SQLObject/tests test.py,1.9,1.10
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: <ian...@us...> - 2003-05-05 17:53:06
|
Update of /cvsroot/sqlobject/SQLObject/tests In directory sc8-pr-cvs1:/tmp/cvs-serv1423/tests Modified Files: test.py Log Message: * SomeClass.q.colName now uses proper dbNames * orderBy clauses translate to dbName Index: test.py =================================================================== RCS file: /cvsroot/sqlobject/SQLObject/tests/test.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test.py 19 Apr 2003 00:54:25 -0000 1.9 --- test.py 5 May 2003 17:35:20 -0000 1.10 *************** *** 21,27 **** classes = [TestSO1] def inserts(self): ! for name, passwd in [('bob', 'god'), ('sally', 'sordid'), ! ('dave', 'dremel'), ('fred', 'forgo')]: TestSO1.new(name=name, passwd=passwd) --- 21,29 ---- classes = [TestSO1] + info = [('bob', 'god'), ('sally', 'sordid'), + ('dave', 'dremel'), ('fred', 'forgo')] + def inserts(self): ! for name, passwd in self.info: TestSO1.new(name=name, passwd=passwd) *************** *** 32,35 **** --- 34,53 ---- ######################################## + ## Delete during select + ######################################## + + class DeleteSelectTest(TestCase1): + + def testGet(self): + return + + def testSelect(self): + for obj in TestSO1.select('all'): + obj.destroySelf() + self.assertEqual(list(TestSO1.select('all')), []) + + + + ######################################## ## Enum test ######################################## *************** *** 280,283 **** --- 298,334 ---- def assertNamesEqual(self, people, dest): self.assertEqual([p.name for p in people], dest) + + ######################################## + ## Inheritance + ######################################## + + class Super(SQLObject): + + _columns = [StringCol('name', length=10)] + + class Sub(Super): + + _columns = Super._columns + [StringCol('name2', length=10)] + + class InheritanceTest(SQLObjectTest): + + classes = [Super, Sub] + + def testSuper(self): + return + print 'super', Super._columns + print 'sub', Sub._columns + s1 = Super.new(name='one') + s2 = Super.new(name='two') + s3 = Super(s1.id) + self.assertEqual(s1, s3) + + def testSub(self): + return + s1 = Sub.new(name='one', name2='1') + s2 = Sub.new(name='two', name2='2') + s3 = Sub(s1.id) + self.assertEqual(s1, s3) + |