@@ -110,11 +110,61 @@ def test_rebuild(self):
110
110
# hierarchies:
111
111
# http://docs.sqlalchemy.org/en/rel_0_9/orm/query.html?highlight=update#sqlalchemy.orm.query.Query.update
112
112
#
113
- # tl;dr: This test will always fail on specialized classes.
113
+ # This test will always fail on specialized classes.
114
114
try :
115
115
super (TestSpecializedTree , self ).test_rebuild ()
116
116
except Exception :
117
117
import nose
118
118
raise nose .SkipTest ()
119
119
else :
120
120
raise AssertionError ('Failure expected' ) # pragma: no cover
121
+
122
+
123
+ Base2 = declarative_base ()
124
+
125
+
126
+ class BaseInheritance (Base2 ):
127
+ __tablename__ = "base_inheritance"
128
+
129
+ ppk = sa .Column ('idd' , sa .Integer , primary_key = True )
130
+ type = sa .Column (sa .Integer , default = 0 )
131
+ visible = sa .Column (sa .Boolean )
132
+
133
+ __mapper_args__ = {
134
+ 'polymorphic_identity' : 0 ,
135
+ 'polymorphic_on' : type ,
136
+ }
137
+
138
+ def __repr__ (self ):
139
+ return "<Node (%s)>" % self .ppk
140
+
141
+
142
+ class InheritanceTree (BaseInheritance , BaseNestedSets ):
143
+ __tablename__ = "inheriance_tree"
144
+
145
+ ppk = sa .Column ('idd' , sa .Integer , sa .ForeignKey (BaseInheritance .ppk ),
146
+ primary_key = True )
147
+ sqlalchemy_mptt_pk_name = 'ppk'
148
+
149
+ __mapper_args__ = {
150
+ 'polymorphic_identity' : 1 ,
151
+ }
152
+
153
+
154
+ class TestInheritanceTree (TreeTestingMixin , unittest .TestCase ):
155
+ base = Base2
156
+ model = InheritanceTree
157
+
158
+ def test_rebuild (self ):
159
+ # See the following URL for caveats when using update on mapped
160
+ # hierarchies:
161
+ # http://docs.sqlalchemy.org/en/rel_0_9/orm/query.html?highlight=update#sqlalchemy.orm.query.Query.update
162
+ #
163
+ # This test will always fail on specialized classes.
164
+ try :
165
+ super (TestInheritanceTree , self ).test_rebuild ()
166
+ except Exception :
167
+ import nose
168
+ raise nose .SkipTest ()
169
+ else :
170
+ raise AssertionError ('Failure expected' ) # pragma: no cover
0 commit comments