]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
converted tests to use remote_side and foreign_keys. but...wow these are hard tests..
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 10 Jan 2008 06:51:51 +0000 (06:51 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 10 Jan 2008 06:51:51 +0000 (06:51 +0000)
test/orm/relationships.py

index 8e2039630c2b5263fe720a0b09d56cac962b90ec..5c657963b0a3e8f74f7ae6717973ad567ca69073 100644 (file)
@@ -133,9 +133,7 @@ class RelationTest2(PersistTest):
     def tearDownAll(self):
         metadata.drop_all()
 
-    @testing.uses_deprecated('foreignkey option')
-    # TODO: fixme!
-    def testexplicit(self):
+    def test_explicit(self):
         """test with mappers that have fairly explicit join conditions"""
 
         class Company(object):
@@ -155,7 +153,8 @@ class RelationTest2(PersistTest):
                     employee_tbl.c.emp_id==employee_tbl.c.reports_to_id,
                     employee_tbl.c.company_id==employee_tbl.c.company_id
                 ),
-                foreignkey=[employee_tbl.c.company_id, employee_tbl.c.emp_id],
+                remote_side=[employee_tbl.c.emp_id, employee_tbl.c.company_id],
+                foreign_keys=[employee_tbl.c.reports_to_id],
                 backref='employees')
         })
 
@@ -184,9 +183,7 @@ class RelationTest2(PersistTest):
         assert sess.query(Employee).get([c1.company_id, 3]).reports_to.name == 'emp1'
         assert sess.query(Employee).get([c2.company_id, 3]).reports_to.name == 'emp5'
 
-    @testing.uses_deprecated('foreignkey option')
-    # TODO: fixme!
-    def testimplicit(self):
+    def test_implicit(self):
         """test with mappers that have the most minimal arguments"""
         class Company(object):
             pass
@@ -201,7 +198,8 @@ class RelationTest2(PersistTest):
         mapper(Employee, employee_tbl, properties= {
             'company':relation(Company, backref='employees'),
             'reports_to':relation(Employee,
-                foreignkey=[employee_tbl.c.company_id, employee_tbl.c.emp_id],
+                remote_side=[employee_tbl.c.emp_id, employee_tbl.c.company_id],
+                foreign_keys=[employee_tbl.c.reports_to_id],
                 backref='employees')
         })