diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-04-10 14:56:01 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-04-18 12:55:48 -0400 |
| commit | 243b222a232da0da0ac42386f3f38364750b1fcc (patch) | |
| tree | af8870e5f7d8ba2b9eec6897e369b7febfd7e381 /test/orm | |
| parent | 35e93db7ffb5806df22e997fde1f966fa8c453b0 (diff) | |
| download | sqlalchemy-243b222a232da0da0ac42386f3f38364750b1fcc.tar.gz | |
Honor hybrid property / method docstrings
The docstring specified on a hybrid property or method is now honored
at the class level, allowing it to work with tools like Sphinx
autodoc. The mechanics here necessarily involve some wrapping of
expressions to occur for hybrid properties, which may cause them
to appear differently using introspection.
Fixes: #3653
Change-Id: I02549977fe8b2a051802eed7b00cc532fbc214e3
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/239
Diffstat (limited to 'test/orm')
| -rw-r--r-- | test/orm/test_utils.py | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/test/orm/test_utils.py b/test/orm/test_utils.py index 168cee19c..3c783c03d 100644 --- a/test/orm/test_utils.py +++ b/test/orm/test_utils.py @@ -159,8 +159,10 @@ class AliasedClassTest(fixtures.TestBase, AssertsCompiledSQL): self._fixture(Point) alias = aliased(Point) - eq_(str(Point.double_x), "point.x * :x_1") - eq_(str(alias.double_x), "point_1.x * :x_1") + eq_(str(Point.double_x), "Point.double_x") + eq_(str(alias.double_x), "AliasedClass_Point.double_x") + eq_(str(Point.double_x.__clause_element__()), "point.x * :x_1") + eq_(str(alias.double_x.__clause_element__()), "point_1.x * :x_1") sess = Session() @@ -183,10 +185,22 @@ class AliasedClassTest(fixtures.TestBase, AssertsCompiledSQL): self._fixture(Point) alias = aliased(Point) - eq_(str(Point.x_alone), "Point.x") - eq_(str(alias.x_alone), "AliasedClass_Point.x") + eq_(str(Point.x_alone), "Point.x_alone") + eq_(str(alias.x_alone), "AliasedClass_Point.x_alone") - assert Point.x_alone is Point.x + # from __clause_element__() perspective, Point.x_alone + # and Point.x return the same thing, so that's good + eq_(str(Point.x.__clause_element__()), "point.x") + eq_(str(Point.x_alone.__clause_element__()), "point.x") + + # same for the alias + eq_(str(alias.x + 1), "point_1.x + :x_1") + eq_(str(alias.x_alone + 1), "point_1.x + :x_1") + + is_( + Point.x_alone.__clause_element__(), + Point.x.__clause_element__() + ) eq_(str(alias.x_alone == alias.x), "point_1.x = point_1.x") |
