From: Jason Kirtland Date: Thu, 21 Jun 2007 21:01:04 +0000 (+0000) Subject: - expanded assignment test, ensure that re-assigning the value of X-Git-Tag: rel_0_4_6~185 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=64e920cee8ef32e94ded056894578cffa16b27bd;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - expanded assignment test, ensure that re-assigning the value of an association mutates the backing object (rather than a delete and create with new primary keys) --- diff --git a/test/ext/associationproxy.py b/test/ext/associationproxy.py index 61eb5ab129..0d6329fd60 100644 --- a/test/ext/associationproxy.py +++ b/test/ext/associationproxy.py @@ -133,6 +133,13 @@ class _CollectionOperations(PersistTest): self.assert_(len(p1._children) == 3) self.assert_(len(p1.children) == 3) + p1.children[1] = 'changed-in-place' + self.assert_(p1.children[1] == 'changed-in-place') + inplace_id = p1._children[1].id + p1 = self.roundtrip(p1) + self.assert_(p1.children[1] == 'changed-in-place') + assert p1._children[1].id == inplace_id + p1._children = [] self.assert_(len(p1.children) == 0) @@ -220,8 +227,12 @@ class CustomDictTest(DictTest): self.assert_(len(p1._children) == 3) self.assert_(len(p1.children) == 3) - p1.children['d'] = 'new d' - assert p1.children['d'] == 'new d' + p1.children['e'] = 'changed-in-place' + self.assert_(p1.children['e'] == 'changed-in-place') + inplace_id = p1._children['e'].id + p1 = self.roundtrip(p1) + self.assert_(p1.children['e'] == 'changed-in-place') + self.assert_(p1._children['e'].id == inplace_id) p1._children = {} self.assert_(len(p1.children) == 0)