From c3be2e5f8a84f3d54a27ceb249442d194260212b Mon Sep 17 00:00:00 2001 From: Tim Richardson Date: Fri, 21 Jun 2013 11:20:17 +1000 Subject: [PATCH] test case for the changes allowing a compute field to refer to an earlier defined compute field --- gluon/tests/test_dal.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/gluon/tests/test_dal.py b/gluon/tests/test_dal.py index f4423b54..ab444958 100644 --- a/gluon/tests/test_dal.py +++ b/gluon/tests/test_dal.py @@ -599,6 +599,19 @@ class TestComputedFields(unittest.TestCase): self.assertEqual(db.tt[id].cc,'zx') db.tt.drop() db.commit() + + # test checking that a compute field can refer to earlier-defined computed fields + db.define_table('tt', + Field('aa'), + Field('bb',default='x'), + Field('cc',compute=lambda r: r.aa+r.bb), + Field('dd',compute=lambda r: r.bb + r.cc)) + db.commit() + id = db.tt.insert(aa="z") + self.assertEqual(db.tt[id].dd,'xzx') + db.tt.drop() + db.commit() + class TestCommonFilters(unittest.TestCase):