From: Mike Bayer Date: Sat, 11 Feb 2006 19:43:06 +0000 (+0000) Subject: crazy postgres and its foreign key constraints X-Git-Tag: rel_0_1_0~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=349c00c97a1931cb28cb199b12af1bde82f5bd1d;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git crazy postgres and its foreign key constraints --- diff --git a/test/cycles.py b/test/cycles.py index f343009fb3..556008998c 100644 --- a/test/cycles.py +++ b/test/cycles.py @@ -85,8 +85,8 @@ class CycleTest(AssertMixin): t1.create() t2.c.c2.append_item(ForeignKey('t1.c1')) def tearDownAll(self): - t2.drop() t1.drop() + t2.drop() def setUp(self): objectstore.clear() #objectstore.LOG = True @@ -192,13 +192,13 @@ class CycleTest2(AssertMixin): Column('person_id', Integer), ) - person.create() ball.create() + person.create() ball.c.person_id.append_item(ForeignKey('person.id')) def tearDownAll(self): - ball.drop() person.drop() + ball.drop() def setUp(self): objectstore.clear() diff --git a/test/manytomany.py b/test/manytomany.py index ffc75d0d06..611ac30c09 100644 --- a/test/manytomany.py +++ b/test/manytomany.py @@ -67,6 +67,7 @@ class M2MTest(testbase.AssertMixin): def tearDownAll(self): place_input.drop() place_output.drop() + place_thingy.drop() place.drop() transition.drop() diff --git a/test/query.py b/test/query.py index e89d40b1ef..9c2bcfe441 100644 --- a/test/query.py +++ b/test/query.py @@ -145,26 +145,28 @@ class QueryTest(PersistTest): Column('shadow_id', INT, primary_key = True), Column('shadow_name', VARCHAR(20)), Column('parent', VARCHAR(20)), - Column('row', VARCHAR(20)), + Column('row', VARCHAR(40)), Column('__parent', VARCHAR(20)), Column('__row', VARCHAR(20)), redefine = True ) shadowed.create() - shadowed.insert().execute(shadow_id=1, shadow_name='The Shadow', parent='The Light', row='Without light there is no shadow', __parent='Hidden parent', __row='Hidden row') - r = shadowed.select(shadowed.c.shadow_id==1).execute().fetchone() - self.assert_(r.shadow_id == r['shadow_id'] == r[shadowed.c.shadow_id] == 1) - self.assert_(r.shadow_name == r['shadow_name'] == r[shadowed.c.shadow_name] == 'The Shadow') - self.assert_(r.parent == r['parent'] == r[shadowed.c.parent] == 'The Light') - self.assert_(r.row == r['row'] == r[shadowed.c.row] == 'Without light there is no shadow') - self.assert_(r['__parent'] == 'Hidden parent') - self.assert_(r['__row'] == 'Hidden row') try: - print r.__parent, r.__row - self.fail('Should not allow access to private attributes') - except AttributeError: - pass # expected - + shadowed.insert().execute(shadow_id=1, shadow_name='The Shadow', parent='The Light', row='Without light there is no shadow', __parent='Hidden parent', __row='Hidden row') + r = shadowed.select(shadowed.c.shadow_id==1).execute().fetchone() + self.assert_(r.shadow_id == r['shadow_id'] == r[shadowed.c.shadow_id] == 1) + self.assert_(r.shadow_name == r['shadow_name'] == r[shadowed.c.shadow_name] == 'The Shadow') + self.assert_(r.parent == r['parent'] == r[shadowed.c.parent] == 'The Light') + self.assert_(r.row == r['row'] == r[shadowed.c.row] == 'Without light there is no shadow') + self.assert_(r['__parent'] == 'Hidden parent') + self.assert_(r['__row'] == 'Hidden row') + try: + print r.__parent, r.__row + self.fail('Should not allow access to private attributes') + except AttributeError: + pass # expected + finally: + shadowed.drop() if __name__ == "__main__": testbase.main()