From 2a8c04c69fd10b4083ab84dcf31df87e518d938a Mon Sep 17 00:00:00 2001 From: ilvalle Date: Wed, 3 Dec 2014 19:32:25 +0100 Subject: [PATCH] better SQLCustomType tests --- gluon/tests/test_dal.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gluon/tests/test_dal.py b/gluon/tests/test_dal.py index 9fd33ec3..464cb3dc 100644 --- a/gluon/tests/test_dal.py +++ b/gluon/tests/test_dal.py @@ -1578,8 +1578,13 @@ class TestSQLCustomType(unittest.TestCase): def testRun(self): db = DAL(DEFAULT_URI, check_reserved=['all']) from dal.helpers.classes import SQLCustomType - basic_t = SQLCustomType(type = "double", native = "double") - basic_t_str = SQLCustomType(type = "string", native = "string") + native_double = "double" + native_string = "string" + if hasattr(db._adapter, 'types'): + native_double = db._adapter.types['double'] + native_string = db._adapter.types['string'] % {'length': 256} + basic_t = SQLCustomType(type = "double", native = native_double) + basic_t_str = SQLCustomType(type = "string", native = native_string) t0=db.define_table('t0', Field("price", basic_t), Field("product", basic_t_str)) r_id = t0.insert(price=None, product=None) row = db(t0.id == r_id).select(t0.ALL).first()