summaryrefslogtreecommitdiff
path: root/test/orm
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2014-09-10 14:14:50 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2014-09-10 14:14:50 -0400
commit14d2bb074cccdec32bd26a89353c30fd512b2aa2 (patch)
treeb8bea89172c620f0f015edd5359681e304a19ac6 /test/orm
parent706d4fcc4f69b74a502be41f5eea3fedd9413bc7 (diff)
downloadsqlalchemy-14d2bb074cccdec32bd26a89353c30fd512b2aa2.tar.gz
- Fixed bug in ordering list where the order of items would be
thrown off during a collection replace event, if the reorder_on_append flag were set to True. The fix ensures that the ordering list only impacts the list that is explicitly associated with the object. fixes #3191
Diffstat (limited to 'test/orm')
-rw-r--r--test/orm/test_collection.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/orm/test_collection.py b/test/orm/test_collection.py
index f94c742b3..82331b9af 100644
--- a/test/orm/test_collection.py
+++ b/test/orm/test_collection.py
@@ -2191,6 +2191,23 @@ class InstrumentationTest(fixtures.ORMTest):
f1.attr = l2
eq_(canary, [adapter_1, f1.attr._sa_adapter, None])
+ def test_referenced_by_owner(self):
+
+ class Foo(object):
+ pass
+
+ instrumentation.register_class(Foo)
+ attributes.register_attribute(
+ Foo, 'attr', uselist=True, useobject=True)
+
+ f1 = Foo()
+ f1.attr.append(3)
+
+ adapter = collections.collection_adapter(f1.attr)
+ assert adapter._referenced_by_owner
+
+ f1.attr = []
+ assert not adapter._referenced_by_owner