diff options
author | Nils Philippsen <nils@redhat.com> | 2015-11-09 14:50:23 +0100 |
---|---|---|
committer | Nils Philippsen <nils@redhat.com> | 2015-11-25 16:03:59 +0100 |
commit | 58f73d2278393d813c7f39736fc96c5086f18f6d (patch) | |
tree | fb4123cde07619fffd1c7f0be49e46bf8c8339fd /test/ext/declarative/test_basic.py | |
parent | 054b22c7867722a256bfe8dd74eada4da378a601 (diff) | |
download | sqlalchemy-pr/212.tar.gz |
py2k: accept unicode literals on :func:`backref`, toopr/212
Fixed bug where in Py2K a unicode literal would not be accepted as the
string name of a class or other argument within declarative using
:func:`.backref` on :func:`.relationship`.
amends commit e6f67f48054d906856f879bc1803ea639aa4b670
Diffstat (limited to 'test/ext/declarative/test_basic.py')
-rw-r--r-- | test/ext/declarative/test_basic.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/ext/declarative/test_basic.py b/test/ext/declarative/test_basic.py index 5165d9cc9..ae1a85f8b 100644 --- a/test/ext/declarative/test_basic.py +++ b/test/ext/declarative/test_basic.py @@ -102,6 +102,29 @@ class DeclarativeTest(DeclarativeTestBase): assert User.addresses.property.mapper.class_ is Address + def test_unicode_string_resolve_backref(self): + class User(Base, fixtures.ComparableEntity): + __tablename__ = 'users' + + id = Column('id', Integer, primary_key=True, + test_needs_autoincrement=True) + name = Column('name', String(50)) + + class Address(Base, fixtures.ComparableEntity): + __tablename__ = 'addresses' + + id = Column(Integer, primary_key=True, + test_needs_autoincrement=True) + email = Column(String(50), key='_email') + user_id = Column('user_id', Integer, ForeignKey('users.id'), + key='_user_id') + user = relationship( + User, + backref=backref("addresses", + order_by=util.u("Address.email"))) + + assert Address.user.property.mapper.class_ is User + def test_no_table(self): def go(): class User(Base): |