summaryrefslogtreecommitdiff
path: root/test/orm/test_attributes.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2014-03-19 11:09:38 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2014-03-19 11:09:38 -0400
commitb9a2b58dd74757184ef94206f09e9db1f536e4cb (patch)
tree58dd9631ac97aa1b0d5e335f3f3eab5c7c872625 /test/orm/test_attributes.py
parentfd8dbf8e78981187d091dcc25e63ddfb4e56a5f8 (diff)
downloadsqlalchemy-b9a2b58dd74757184ef94206f09e9db1f536e4cb.tar.gz
- Fixed bug in mutable extension as well as
:func:`.attributes.flag_modified` where the change event would not be propagated if the attribute had been reassigned to itself. fixes #2997
Diffstat (limited to 'test/orm/test_attributes.py')
-rw-r--r--test/orm/test_attributes.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/orm/test_attributes.py b/test/orm/test_attributes.py
index 4f8092f31..a7c675175 100644
--- a/test/orm/test_attributes.py
+++ b/test/orm/test_attributes.py
@@ -1852,6 +1852,21 @@ class HistoryTest(fixtures.TestBase):
f.someattr = ['a']
eq_(self._someattr_history(f), ([['a']], (), ()))
+ def test_scalar_inplace_mutation_replace_self_flag_modified_set(self):
+ Foo = self._fixture(uselist=False, useobject=False,
+ active_history=False)
+ f = Foo()
+ f.someattr = {'a': 'b'}
+ self._commit_someattr(f)
+ eq_(self._someattr_history(f), ((), [{'a': 'b'}], ()))
+
+ # set the attribute to itself; this places a copy
+ # in committed_state
+ f.someattr = f.someattr
+
+ attributes.flag_modified(f, 'someattr')
+ eq_(self._someattr_history(f), ([{'a': 'b'}], (), ()))
+
def test_use_object_init(self):
Foo, Bar = self._two_obj_fixture(uselist=False)