From: Mike Bayer Date: Fri, 27 Apr 2007 20:13:01 +0000 (+0000) Subject: extra tests that unneeded UPDATEs dont occur X-Git-Tag: rel_0_3_7~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ef9580f984f4f901e36196b0f05cedbdb6452627;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git extra tests that unneeded UPDATEs dont occur --- diff --git a/test/orm/unitofwork.py b/test/orm/unitofwork.py index 7f617b536d..f4da9cf61f 100644 --- a/test/orm/unitofwork.py +++ b/test/orm/unitofwork.py @@ -278,14 +278,32 @@ class MutableTypesTest(UnitOfWorkTest): f1 = Foo() f1.data = pickleable.BarWithoutCompare(4,5) ctx.current.flush() + + def go(): + ctx.current.flush() + self.assert_sql_count(db, go, 0) + ctx.current.clear() + f2 = ctx.current.query(Foo).get_by(id=f1.id) + + def go(): + ctx.current.flush() + self.assert_sql_count(db, go, 0) + f2.data.y = 19 - ctx.current.flush() + def go(): + ctx.current.flush() + self.assert_sql_count(db, go, 1) + ctx.current.clear() f3 = ctx.current.query(Foo).get_by(id=f1.id) print f2.data, f3.data assert (f3.data.x, f3.data.y) == (4,19) + + def go(): + ctx.current.flush() + self.assert_sql_count(db, go, 0) def testunicode(self): """test that two equivalent unicode values dont get flagged as changed.