From: Mike Bayer Date: Fri, 30 Nov 2007 21:25:42 +0000 (+0000) Subject: added test to ensure two conflicting m2m + backrefs raise an error X-Git-Tag: rel_0_4_2~118 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=ebb4b02c2136b3a71989867a52665e34bdfd4236;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git added test to ensure two conflicting m2m + backrefs raise an error --- diff --git a/test/orm/manytomany.py b/test/orm/manytomany.py index 8b310f86c5..5608ae67de 100644 --- a/test/orm/manytomany.py +++ b/test/orm/manytomany.py @@ -2,7 +2,7 @@ import testbase from sqlalchemy import * from sqlalchemy.orm import * from testlib import * - +from sqlalchemy import exceptions class Place(object): '''represents a place''' @@ -68,6 +68,19 @@ class M2MTest(ORMTest): Column('pl2_id', Integer, ForeignKey('place.place_id')), ) + def testerror(self): + mapper(Place, place, properties={ + 'transitions':relation(Transition, secondary=place_input, backref='places') + }) + mapper(Transition, transition, properties={ + 'places':relation(Place, secondary=place_input, backref='transitions') + }) + try: + compile_mappers() + assert False + except exceptions.ArgumentError, e: + assert str(e) == "Error creating backref 'transitions' on relation 'Transition.places (Place)': property of that name exists on mapper 'Mapper|Place|place'" + def testcircular(self): """tests a many-to-many relationship from a table to itself."""