Commits

Mike Bayer committed 17de3df

test case to disprove [ticket:1126]

Comments (0)

Files changed (1)

test/orm/inheritance/basic.py

         sess.add(s1)
         sess.flush()
         assert sess.query(Sub).one().data == "im the data"
+    
+    def test_two_levels(self):
+        class Base(object):
+            pass
+
+        class Sub(Base):
+            @property
+            def data(self):
+                return "im sub"
+
+        class SubSub(Sub):
+            @property
+            def data(self):
+                return "im sub sub"
+        
+        mapper(Base, base)
+        mapper(Sub, subtable, inherits=Base)
+        mapper(SubSub, inherits=Sub)
+        
+        sess = create_session()
+        s1 = Sub()
+        assert s1.data == "im sub"
+        s2 = SubSub()
+        assert s2.data == "im sub sub"
+        b1 = Base()
+        b1.data="this is some data"
+        assert b1.data == "this is some data"
+        
+        sess.add_all([s1, s2, b1])
+        sess.flush()
+        sess.clear()
+        
+        assert sess.query(Sub).get(s1.base_id).data == "im sub"
+        assert sess.query(SubSub).get(s2.base_id).data == "im sub sub"
         
 class DeleteOrphanTest(ORMTest):
     def define_tables(self, metadata):