diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-10-08 02:46:40 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-10-08 02:46:40 +0000 |
| commit | 51f16d14980c4a061ea3e224c52acf91008f0b20 (patch) | |
| tree | 5e713ade593621eefe9234b47945595248d39414 /test/engine/reflection.py | |
| parent | 758828ed544966cd78524f450f877be5b789fee4 (diff) | |
| download | sqlalchemy-51f16d14980c4a061ea3e224c52acf91008f0b20.tar.gz | |
- the "foreign_key" attribute on Column and ColumnElement in general
is deprecated, in favor of the "foreign_keys" list/set-based attribute,
which takes into account multiple foreign keys on one column.
"foreign_key" will return the first element in the "foreign_keys" list/set
or None if the list is empty.
- added a user test to the relationships test, testing various new things this
change allows
Diffstat (limited to 'test/engine/reflection.py')
| -rw-r--r-- | test/engine/reflection.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/test/engine/reflection.py b/test/engine/reflection.py index 2e2c50127..45010111e 100644 --- a/test/engine/reflection.py +++ b/test/engine/reflection.py @@ -71,7 +71,6 @@ class ReflectionTest(PersistTest): addresses = Table('engine_email_addresses', meta, autoload = True) # reference the addresses foreign key col, which will require users to be # reflected at some point - print addresses.c.remote_user_id.foreign_key.column users = Table('engine_users', meta, autoload = True) finally: addresses.drop() @@ -120,8 +119,8 @@ class ReflectionTest(PersistTest): autoload=True) u2 = Table('users', meta2, autoload=True) - assert a2.c.user_id.foreign_key is not None - assert a2.c.user_id.foreign_key.parent is a2.c.user_id + assert len(a2.c.user_id.foreign_keys)>0 + assert list(a2.c.user_id.foreign_keys)[0].parent is a2.c.user_id assert u2.join(a2).onclause == u2.c.id==a2.c.user_id meta3 = BoundMetaData(testbase.db) @@ -336,8 +335,8 @@ class ReflectionTest(PersistTest): assert table_c.c.description.nullable assert table.primary_key is not table_c.primary_key assert [x.name for x in table.primary_key] == [x.name for x in table_c.primary_key] - assert table2_c.c.myid.foreign_key.column is table_c.c.myid - assert table2_c.c.myid.foreign_key.column is not table.c.myid + assert list(table2_c.c.myid.foreign_keys)[0].column is table_c.c.myid + assert list(table2_c.c.myid.foreign_keys)[0].column is not table.c.myid # mysql throws its own exception for no such table, resulting in # a sqlalchemy.SQLError instead of sqlalchemy.NoSuchTableError. |
