diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2018-03-21 09:59:46 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2018-03-21 13:08:19 -0400 |
| commit | 37955a52995cdbb66a9d5835c20ee58fb98ddffc (patch) | |
| tree | f39efcfeb9541bb242e512c93398765e59a6cab6 /test/ext | |
| parent | 0fd508ad32a6f94653757a5ae10c1eae14e099fc (diff) | |
| download | sqlalchemy-37955a52995cdbb66a9d5835c20ee58fb98ddffc.tar.gz | |
Don't warn for mixin-based __table_args__, __mapper_args__ declared_attr
Removed a warning that would be emitted when calling upon
``__table_args__``, ``__mapper_args__`` as named with a ``@declared_attr``
method, when called from a non-mapped declarative mixin. Calling these
directly is documented as the approach to use when one is overidding one
of these methods on a mapped class. The warning still emits for regular
attribute names.
Change-Id: Iae7ed0bd625a2c163c910aa777cef4779128580a
Fixes: #4221
Diffstat (limited to 'test/ext')
| -rw-r--r-- | test/ext/declarative/test_mixin.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ext/declarative/test_mixin.py b/test/ext/declarative/test_mixin.py index 0b1b117fb..07c790dc4 100644 --- a/test/ext/declarative/test_mixin.py +++ b/test/ext/declarative/test_mixin.py @@ -1540,6 +1540,19 @@ class DeclaredAttrTest(DeclarativeTestBase, testing.AssertsCompiledSQL): getattr, Mixin, "my_prop" ) + def test_can_we_access_the_mixin_straight_special_names(self): + class Mixin(object): + @declared_attr + def __table_args__(cls): + return (1, 2, 3) + + @declared_attr + def __arbitrary__(cls): + return (4, 5, 6) + + eq_(Mixin.__table_args__, (1, 2, 3)) + eq_(Mixin.__arbitrary__, (4, 5, 6)) + def test_non_decl_access(self): counter = mock.Mock() |
