diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-11-29 18:15:52 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-11-29 18:15:52 -0500 |
| commit | e6f67f48054d906856f879bc1803ea639aa4b670 (patch) | |
| tree | df41029eafc06b0e0d7453d7df0f50bff486f9d7 /test/ext | |
| parent | 1e7bb35fd2d58cc5928932d920e665b5c1b02174 (diff) | |
| download | sqlalchemy-e6f67f48054d906856f879bc1803ea639aa4b670.tar.gz | |
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:`.relationship`.
Diffstat (limited to 'test/ext')
| -rw-r--r-- | test/ext/declarative/test_basic.py | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/test/ext/declarative/test_basic.py b/test/ext/declarative/test_basic.py index 8917d7772..f5e7f2aa7 100644 --- a/test/ext/declarative/test_basic.py +++ b/test/ext/declarative/test_basic.py @@ -4,7 +4,7 @@ from sqlalchemy.testing import eq_, assert_raises, \ from sqlalchemy.ext import declarative as decl from sqlalchemy import exc import sqlalchemy as sa -from sqlalchemy import testing +from sqlalchemy import testing, util from sqlalchemy import MetaData, Integer, String, ForeignKey, \ ForeignKeyConstraint, Index from sqlalchemy.testing.schema import Table, Column @@ -77,6 +77,26 @@ class DeclarativeTest(DeclarativeTestBase): eq_(a1, Address(email='two')) eq_(a1.user, User(name='u1')) + def test_unicode_string_resolve(self): + class User(Base, fixtures.ComparableEntity): + __tablename__ = 'users' + + id = Column('id', Integer, primary_key=True, + test_needs_autoincrement=True) + name = Column('name', String(50)) + addresses = relationship(util.u("Address"), backref="user") + + 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') + + assert User.addresses.property.mapper.class_ is Address + def test_no_table(self): def go(): class User(Base): |
