]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
added a failing unittest for inheriting mappers with add_property
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 11 Apr 2006 16:59:18 +0000 (16:59 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 11 Apr 2006 16:59:18 +0000 (16:59 +0000)
test/inheritance.py

index 3202c34178af977b4b970de4a5903fefcdeeb3fe..94784416160708963675e5587536272f205acd0c 100644 (file)
@@ -374,7 +374,7 @@ class InheritTest5(testbase.AssertMixin):
     def testbasic(self):
         class ContentType(object): pass
         class Content(object): pass
-        class Product(object): pass
+        class Product(Content): pass
 
         content_types = mapper(ContentType, content_type)
         contents = mapper(Content, content, properties={
@@ -383,7 +383,22 @@ class InheritTest5(testbase.AssertMixin):
         #contents.add_property('content_type', relation(content_types)) #adding this makes the inheritance stop working
         # shouldnt throw exception
         products = mapper(Product, product, inherits=contents)
+    
+    def testbackref(self):
+        class ContentType(object): pass
+        class Content(object): pass
+        class Product(Content): pass
+
+        # this test fails currently
+        contents = mapper(Content, content)
+        products = mapper(Product, product, inherits=contents)
+        content_types = mapper(ContentType, content_type, properties={
+            'content':relation(contents, backref='contenttype')
+        })
+        p = Product()
+        p.contenttype = ContentType()
         
+            
 class InheritTest6(testbase.AssertMixin):
     """tests eager load/lazy load of child items off inheritance mappers, tests that
     LazyLoader constructs the right query condition."""