summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJonathan LaCour <jonathan@cleverdevil.org>2006-06-29 23:29:37 +0000
committerJonathan LaCour <jonathan@cleverdevil.org>2006-06-29 23:29:37 +0000
commit4e3aa8829acfe824ccb6628be4a1f6af8e220349 (patch)
tree79d29782a2f1c861f51436dd0162aec17dc3a156 /test
parent2c28effb75c4578d34c85ed79aaec079e0734ca2 (diff)
downloadsqlalchemy-4e3aa8829acfe824ccb6628be4a1f6af8e220349.tar.gz
There were two significant changes in this commit:
* Added implicit primary keys to ActiveMapper. Now, if you do not speicfy a primary key on your objects when declaring them, an Integer primary key called `id` will automatically be added to your objects for you. * Commented out a large chunk of the process_relationships function that should no longer be necessary thanks to some of the deferred mapper compilation that was added in SQLAlchemy 0.2.3. I left it in the code, but commented it out just in case this change causes a problem in someone's else's code and I can put it back in if needed.
Diffstat (limited to 'test')
-rw-r--r--test/ext/activemapper.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/test/ext/activemapper.py b/test/ext/activemapper.py
index ef6886a78..1bb93dd63 100644
--- a/test/ext/activemapper.py
+++ b/test/ext/activemapper.py
@@ -13,7 +13,6 @@ class testcase(testbase.PersistTest):
class Person(ActiveMapper):
class mapping:
- id = column(Integer, primary_key=True)
full_name = column(String)
first_name = column(String)
middle_name = column(String)
@@ -43,12 +42,15 @@ class testcase(testbase.PersistTest):
class Preferences(ActiveMapper):
class mapping:
__table__ = 'preferences'
- id = column(Integer, primary_key=True)
favorite_color = column(String)
personality_type = column(String)
class Address(ActiveMapper):
class mapping:
+ # note that in other objects, the 'id' primary key is
+ # automatically added -- if you specify a primary key,
+ # then ActiveMapper will not add an integer primary key
+ # for you.
id = column(Integer, primary_key=True)
type = column(String)
address_1 = column(String)
@@ -216,10 +218,6 @@ class testcase(testbase.PersistTest):
)
self.assertEquals(len(results), 1)
-
if __name__ == '__main__':
- # go ahead and setup the database connection, and create the tables
-
- # launch the unit tests
unittest.main()