summaryrefslogtreecommitdiff
path: root/test/orm/test_mapper.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2011-08-06 19:30:34 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2011-08-06 19:30:34 -0400
commite548b7f8ffd29a909c9b02e1ff5e307aa6ee7b0b (patch)
treee952de9de167ac0825c2552aba632051aaad25c4 /test/orm/test_mapper.py
parent4abcc0da839a57513f18a7a9ea7ee6918d48e4b1 (diff)
downloadsqlalchemy-e548b7f8ffd29a909c9b02e1ff5e307aa6ee7b0b.tar.gz
- Repaired edge case where mapper would fail
to fully update internal state when a relationship on a new mapper would establish a backref on the first mapper. - continuing with tutorial, moving eager loading into its own place and describing more fully
Diffstat (limited to 'test/orm/test_mapper.py')
-rw-r--r--test/orm/test_mapper.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/test/orm/test_mapper.py b/test/orm/test_mapper.py
index 4ec3ab0fb..ba477e8e6 100644
--- a/test/orm/test_mapper.py
+++ b/test/orm/test_mapper.py
@@ -246,8 +246,8 @@ class MapperTest(_fixtures.FixtureTest):
"""test that _sort_states() doesn't compare
insert_order to state.key, for set of mixed
persistent/pending. In particular Python 3 disallows
- this.
-
+ this.
+
"""
class Foo(object):
def __init__(self, id):
@@ -430,6 +430,21 @@ class MapperTest(_fixtures.FixtureTest):
sess.flush()
sess.rollback()
+ def test_add_prop_via_backref_resets_memoizations_reconfigures(self):
+ users, User = self.tables.users, self.classes.User
+ addresses, Address = self.tables.addresses, self.classes.Address
+
+ m1 = mapper(User, users)
+ User()
+
+ m2 = mapper(Address, addresses, properties={
+ 'user':relationship(User, backref="addresses")
+ })
+ # configure mappers takes place when User is generated
+ User()
+ assert hasattr(User, 'addresses')
+ assert "addresses" in [p.key for p in m1._polymorphic_properties]
+
def test_replace_property(self):
users, User = self.tables.users, self.classes.User