"""
return exclusions.closed()
+ @property
+ def implicit_decimal_binds(self):
+ """target backend will return a selected Decimal as a Decimal, not
+ a string.
+
+ e.g.::
+
+ expr = decimal.Decimal("15.7563")
+
+ value = e.scalar(
+ select([literal(expr)])
+ )
+
+ assert value == expr
+
+ See :ticket:`4036`
+
+ """
+
+ return exclusions.open()
+
@property
def nested_aggregates(self):
"""target database can select an aggregate from a subquery that's
)
eq_(val, expr)
- # TODO: this one still breaks on MySQL
- # def test_decimal_coerce_round_trip(self):
- # expr = decimal.Decimal("15.7563")
- #
- # val = testing.db.scalar(
- # select([literal(expr)])
- # )
- # eq_(val, expr)
+ # this does not work in MySQL, see #4036, however we choose not
+ # to render CAST unconditionally since this is kind of an edge case.
+
+ @testing.requires.implicit_decimal_binds
+ @testing.emits_warning(r".*does \*not\* support Decimal objects natively")
+ def test_decimal_coerce_round_trip(self):
+ expr = decimal.Decimal("15.7563")
+
+ val = testing.db.scalar(
+ select([literal(expr)])
+ )
+ eq_(val, expr)
+
+ @testing.emits_warning(r".*does \*not\* support Decimal objects natively")
+ def test_decimal_coerce_round_trip_w_cast(self):
+ expr = decimal.Decimal("15.7563")
+
+ val = testing.db.scalar(
+ select([cast(expr, Numeric(10, 4))])
+ )
+ eq_(val, expr)
@testing.requires.precision_numerics_general
def test_precision_decimal(self):
'postgresql+psycopg2cffi has FP inaccuracy even with '
'only four decimal places ')])
+ @property
+ def implicit_decimal_binds(self):
+ """target backend will return a selected Decimal as a Decimal, not
+ a string.
+
+ e.g.::
+
+ expr = decimal.Decimal("15.7563")
+
+ value = e.scalar(
+ select([literal(expr)])
+ )
+
+ assert value == expr
+
+ See :ticket:`4036`
+
+ """
+
+ return exclusions.fails_on("mysql+mysqldb", "driver specific")
+
@property
def fetch_null_from_numeric(self):
return skip_if(