diff options
| author | mike bayer <mike_mp@zzzcomputing.com> | 2017-06-26 11:56:38 -0400 |
|---|---|---|
| committer | Gerrit Code Review <gerrit@awstats.zzzcomputing.com> | 2017-06-26 11:56:38 -0400 |
| commit | e04594339c19c3cd8b8e0d96ce83e5ded961dbb7 (patch) | |
| tree | 507edb6a721047f8aa81f760a5299bb18e6bbcb7 /lib/sqlalchemy | |
| parent | 9f1a375f10cb7af558a9549081a0e792546aca21 (diff) | |
| parent | 1776597131ef96472b5188cebc72c31a387c90f4 (diff) | |
| download | sqlalchemy-e04594339c19c3cd8b8e0d96ce83e5ded961dbb7.tar.gz | |
Merge "Coerce float Python type to Float; ensure Python float coming back"
Diffstat (limited to 'lib/sqlalchemy')
| -rw-r--r-- | lib/sqlalchemy/sql/sqltypes.py | 2 | ||||
| -rw-r--r-- | lib/sqlalchemy/testing/suite/test_types.py | 18 |
2 files changed, 19 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql/sqltypes.py b/lib/sqlalchemy/sql/sqltypes.py index 7a3c50549..06b5e5c19 100644 --- a/lib/sqlalchemy/sql/sqltypes.py +++ b/lib/sqlalchemy/sql/sqltypes.py @@ -2604,7 +2604,7 @@ MATCHTYPE = MatchType() _type_map = { int: Integer(), - float: Numeric(), + float: Float(), bool: BOOLEANTYPE, decimal.Decimal: Numeric(), dt.date: Date(), diff --git a/lib/sqlalchemy/testing/suite/test_types.py b/lib/sqlalchemy/testing/suite/test_types.py index ee757e1ca..de32e77a4 100644 --- a/lib/sqlalchemy/testing/suite/test_types.py +++ b/lib/sqlalchemy/testing/suite/test_types.py @@ -431,6 +431,24 @@ class NumericTest(_LiteralRoundTripFixture, fixtures.TestBase): filter_=lambda n: n is not None and round(n, 5) or None ) + @testing.fails_on("mysql", "until we do #4020") + def test_float_coerce_round_trip(self): + expr = 15.7563 + + val = testing.db.scalar( + select([literal(expr)]) + ) + 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) + @testing.requires.precision_numerics_general def test_precision_decimal(self): numbers = set([ |
