.. include:: changelog_07.rst
:start-line: 5
+.. changelog::
+ :version: 0.9.7
+ :released:
+
+ .. change::
+ :tags: bug, declarative
+ :tickets: 3097
+ :versions: 1.0.0
+
+ Fixed bug when the declarative ``__abstract__`` flag was not being
+ distinguished for when it was actually the value ``False``.
+ The ``__abstract__`` flag needs to acutally evaluate to a True
+ value at the level being tested.
+
.. changelog::
:version: 0.9.6
:released: June 23, 2014
@event.listens_for(mapper, "before_configured")
def go():
cls.__declare_first__()
- if '__abstract__' in base.__dict__:
+ if '__abstract__' in base.__dict__ and base.__abstract__:
if (base is cls or
(base in cls.__bases__ and not _is_declarative_inherits)
):
eq_(MyModelA.__table__.c.foo.type.__class__, String)
eq_(MyModelB.__table__.c.foo.type.__class__, Integer)
-
def test_not_allowed(self):
class MyMixin:
def test_relationship_primryjoin(self):
self._test_relationship(True)
+
+class AbstractTest(DeclarativeTestBase):
+ def test_abstract_boolean(self):
+
+ class A(Base):
+ __abstract__ = True
+ __tablename__ = 'x'
+ id = Column(Integer, primary_key=True)
+
+ class B(Base):
+ __abstract__ = False
+ __tablename__ = 'y'
+ id = Column(Integer, primary_key=True)
+
+ class C(Base):
+ __abstract__ = False
+ __tablename__ = 'z'
+ id = Column(Integer, primary_key=True)
+
+ class D(Base):
+ __tablename__ = 'q'
+ id = Column(Integer, primary_key=True)
+
+ eq_(set(Base.metadata.tables), set(['y', 'z', 'q']))