summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2006-11-17 17:03:17 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2006-11-17 17:03:17 +0000
commit4ae341fc941ff72c1ff8cfcf5ade740a731f161e (patch)
treeabb28b1eb4f5e9fdfecb83af7f522629c18a88c1
parent6b0e697a890337b701538de77a6d07dff17618fb (diff)
downloadsqlalchemy-4ae341fc941ff72c1ff8cfcf5ade740a731f161e.tar.gz
added extra pickle unittest to insure update occurs/doesnt occur appropriately
-rw-r--r--test/orm/unitofwork.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/orm/unitofwork.py b/test/orm/unitofwork.py
index aebb98f57..9f4e56dd0 100644
--- a/test/orm/unitofwork.py
+++ b/test/orm/unitofwork.py
@@ -264,6 +264,34 @@ class MutableTypesTest(UnitOfWorkTest):
assert f3.data != f1.data
assert f3.data == pickleable.Bar(4, 19)
+ def testmutablechanges(self):
+ """test that mutable changes are detected or not detected correctly"""
+ class Foo(object):pass
+ mapper(Foo, table)
+ f1 = Foo()
+ f1.data = pickleable.Bar(4,5)
+ f1.value = unicode('hi')
+ ctx.current.flush()
+ def go():
+ ctx.current.flush()
+ self.assert_sql_count(db, go, 0)
+ f1.value = unicode('someothervalue')
+ self.assert_sql(db, lambda: ctx.current.flush(), [
+ (
+ "UPDATE mutabletest SET value=:value WHERE mutabletest.id = :mutabletest_id",
+ {'mutabletest_id': 1, 'value': u'someothervalue'}
+ ),
+ ])
+ f1.value = unicode('hi')
+ f1.data.x = 9
+ self.assert_sql(db, lambda: ctx.current.flush(), [
+ (
+ "UPDATE mutabletest SET data=:data, value=:value WHERE mutabletest.id = :mutabletest_id",
+ {'mutabletest_id': 1, 'value': u'hi', 'data':f1.data}
+ ),
+ ])
+
+
def testnocomparison(self):
"""test that types marked as MutableType get changes detected on them when the type has no __eq__ method"""
class Foo(object):pass