Example #1
0
 def test_return_type_detection(self):
     
     for fn in [func.coalesce, func.max, func.min, func.sum]:
         for args, type_ in [
                         ((datetime.date(2007, 10, 5), datetime.date(2005, 10, 15)), sqltypes.Date),
                         ((3, 5), sqltypes.Integer),
                         ((_python_Decimal(3), _python_Decimal(5)), sqltypes.Numeric),
                         (("foo", "bar"), sqltypes.String),
                         ((datetime.datetime(2007, 10, 5, 8, 3, 34), datetime.datetime(2005, 10, 15, 14, 45, 33)), sqltypes.DateTime)
                     ]:
             assert isinstance(fn(*args).type, type_), "%s / %s" % (fn(), type_)
     
     assert isinstance(func.concat("foo", "bar").type, sqltypes.String)
Example #2
0
    def test_return_type_detection(self):

        for fn in [func.coalesce, func.max, func.min, func.sum]:
            for args, type_ in [
                ((datetime.date(2007, 10,
                                5), datetime.date(2005, 10,
                                                  15)), sqltypes.Date),
                ((3, 5), sqltypes.Integer),
                ((_python_Decimal(3), _python_Decimal(5)), sqltypes.Numeric),
                (("foo", "bar"), sqltypes.String),
                ((datetime.datetime(2007, 10, 5, 8, 3, 34),
                  datetime.datetime(2005, 10, 15, 14, 45,
                                    33)), sqltypes.DateTime)
            ]:
                assert isinstance(fn(*args).type,
                                  type_), "%s / %s" % (fn(), type_)

        assert isinstance(func.concat("foo", "bar").type, sqltypes.String)
Example #3
0
 def process(value):
     if value is not None:
         return _python_Decimal(str(value))
     else:
         return value
 def process(value):
     if value is not None:
         return _python_Decimal(str(value))
     else:
         return value