diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-06-14 22:44:59 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-06-14 22:44:59 -0400 |
commit | 79d07c9abc7d4d3abb6bf2ca5ca66e87d3a11f08 (patch) | |
tree | f893aeac44103cae9fb5e21e99c7954043a64bb4 /test/ext/declarative/test_basic.py | |
parent | de08740d7c21fa9dcef453bfd07a3defa428e88f (diff) | |
download | sqlalchemy-79d07c9abc7d4d3abb6bf2ca5ca66e87d3a11f08.tar.gz |
Consult is_attrbute flag to determine descriptor; enable for assoc proxy
Fixed bug where the :attr:`.Mapper.all_orm_descriptors` accessor would
return an entry for the :class:`.Mapper` itself under the declarative
``__mapper___`` key, when this is not a descriptor. The ``.is_attribute``
flag that's present on all :class:`.InspectionAttr` objects is now
consulted, which has also been modified to be ``True`` for an association
proxy, as it was erroneously set to False for this object.
Fixes: #4729
Change-Id: Ia02388cc25d004e32d337140b62a587f3e5a0b7b
Diffstat (limited to 'test/ext/declarative/test_basic.py')
-rw-r--r-- | test/ext/declarative/test_basic.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ext/declarative/test_basic.py b/test/ext/declarative/test_basic.py index b6c911813..935e6f431 100644 --- a/test/ext/declarative/test_basic.py +++ b/test/ext/declarative/test_basic.py @@ -1337,6 +1337,15 @@ class DeclarativeTest(DeclarativeTestBase): eq_(Foo.__mapper__.CHECK, True) + def test_no_change_to_all_descriptors(self): + base = decl.declarative_base() + + class Foo(base): + __tablename__ = "foo" + id = Column(Integer, primary_key=True) + + eq_(Foo.__mapper__.all_orm_descriptors.keys(), ["id"]) + def test_oops(self): with testing.expect_warnings( |