From fc537e41cb1007ddc808cd9065fc969360884f10 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Thu, 10 Jan 2008 06:51:51 +0000 Subject: [PATCH] converted tests to use remote_side and foreign_keys. but...wow these are hard tests.. --- test/orm/relationships.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/test/orm/relationships.py b/test/orm/relationships.py index 8e2039630c..5c657963b0 100644 --- a/test/orm/relationships.py +++ b/test/orm/relationships.py @@ -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') }) -- 2.47.3