Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(4)  |  Call(4)  |  Derive(0)  |  Import(0)

src/c/e/ceilometer-HEAD/ceilometer/storage/sqlalchemy/models.py   ceilometer(Download)
    def process_bind_param(self, value, dialect):
        if value is None:
            return value
        elif dialect.name == 'mysql':
            return utils.dt_to_decimal(value)

src/c/e/ceilometer-HEAD/ceilometer/tests/test_utils.py   ceilometer(Download)
    def test_datetime_to_decimal(self):
        expected = 1356093296.12
        utc_datetime = datetime.datetime.utcfromtimestamp(expected)
        actual = utils.dt_to_decimal(utc_datetime)
        self.assertEqual(expected, float(actual))

src/c/e/ceilometer-HEAD/ceilometer/tests/storage/sqlalchemy/test_models.py   ceilometer(Download)
    def test_process_bind_param_store_decimal_mysql(self):
        expected = utils.dt_to_decimal(self._date)
        result = self._type.process_bind_param(self._date, self._mysql_dialect)
        self.assertEqual(expected, result)
 
    def test_process_result_value_datetime_mysql(self):
        dec_value = utils.dt_to_decimal(self._date)
        result = self._type.process_result_value(dec_value,
                                                 self._mysql_dialect)
        self.assertEqual(self._date, result)