From ef9580f984f4f901e36196b0f05cedbdb6452627 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 27 Apr 2007 20:13:01 +0000 Subject: [PATCH] extra tests that unneeded UPDATEs dont occur --- test/orm/unitofwork.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) 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. -- 2.47.2