objectstore.LOG = True
+"""test cyclical mapper relationships. No assertions yet, but run it with postgres and the
+foreign key checks alone will usually not work if something is wrong"""
class Tester(object):
def __init__(self, data=None):
self.data = data
t1.create()
t2.create()
def tearDownAll(self):
- t1.drop()
t2.drop()
+ t1.drop()
def setUp(self):
objectstore.clear()
clear_mappers()
pass
m1 = mapper(C1, t1, properties = {
- 'c1s' : relation(C1),
- 'c2s' : relation(C2, t2)
+ 'c1s' : relation(C1, private=True),
+ 'c2s' : relation(C2, t2, private=True)
})
a = C1('head c1')
a.c1s[1].c2s.append(C2('child2 data2'))
objectstore.commit()
+ objectstore.delete(a)
+ objectstore.commit()
+
class CycleTest(AssertMixin):
"""tests two mappers with a bi-directional dependency"""
def setUpAll(self):