test case for the changes allowing a compute field to refer to an
earlier defined compute field
This commit is contained in:
@@ -600,6 +600,19 @@ class TestComputedFields(unittest.TestCase):
|
|||||||
db.tt.drop()
|
db.tt.drop()
|
||||||
db.commit()
|
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):
|
class TestCommonFilters(unittest.TestCase):
|
||||||
|
|
||||||
def testRun(self):
|
def testRun(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user