diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-11-08 12:20:23 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-11-17 18:21:48 -0500 |
| commit | 93fad8fb0c5421ad162064e0aa506cb1e70cbf2b (patch) | |
| tree | 6566691a17686e206864856f30d46f6b0982be53 /test/sql | |
| parent | 958f902b1fc528fed0be550bc573545de47ed854 (diff) | |
| download | sqlalchemy-93fad8fb0c5421ad162064e0aa506cb1e70cbf2b.tar.gz | |
remove "native decimal" warning
Removed the warning that emits from the :class:`_types.Numeric` type about
DBAPIs not supporting Decimal values natively. This warning was oriented
towards SQLite, which does not have any real way without additional
extensions or workarounds of handling precision numeric values more than 15
significant digits as it only uses floating point math to represent
numbers. As this is a known and documented limitation in SQLite itself, and
not a quirk of the pysqlite driver, there's no need for SQLAlchemy to warn
for this. The change does not otherwise modify how precision numerics are
handled. Values can continue to be handled as ``Decimal()`` or ``float()``
as configured with the :class:`_types.Numeric`, :class:`_types.Float` , and
related datatypes, just without the ability to maintain precision beyond 15
significant digits when using SQLite, unless alternate representations such
as strings are used.
Fixes: #7299
Change-Id: Ic570f8107177dec3ddbe94c7b43f40057b03276a
Diffstat (limited to 'test/sql')
| -rw-r--r-- | test/sql/test_types.py | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/test/sql/test_types.py b/test/sql/test_types.py index a15d163e0..7f850d00b 100644 --- a/test/sql/test_types.py +++ b/test/sql/test_types.py @@ -90,7 +90,6 @@ from sqlalchemy.testing.schema import Column from sqlalchemy.testing.schema import pep435_enum from sqlalchemy.testing.schema import Table from sqlalchemy.testing.util import picklers -from sqlalchemy.testing.util import round_decimal def _all_dialect_modules(): @@ -3458,7 +3457,7 @@ class NumericRawSQLTest(fixtures.TestBase): metadata.create_all(connection) connection.execute(t.insert(), dict(val=data)) - @testing.fails_on("sqlite", "Doesn't provide Decimal results natively") + @testing.requires.numeric_received_as_decimal_untyped @testing.provide_metadata def test_decimal_fp(self, connection): metadata = self.metadata @@ -3469,7 +3468,7 @@ class NumericRawSQLTest(fixtures.TestBase): assert isinstance(val, decimal.Decimal) eq_(val, decimal.Decimal("45.5")) - @testing.fails_on("sqlite", "Doesn't provide Decimal results natively") + @testing.requires.numeric_received_as_decimal_untyped @testing.provide_metadata def test_decimal_int(self, connection): metadata = self.metadata @@ -3495,11 +3494,7 @@ class NumericRawSQLTest(fixtures.TestBase): val = connection.exec_driver_sql("select val from t").scalar() assert isinstance(val, float) - # some DBAPIs have unusual float handling - if testing.against("oracle+cx_oracle"): - eq_(round_decimal(val, 3), 46.583) - else: - eq_(val, 46.583) + eq_(val, 46.583) class IntervalTest(fixtures.TablesTest, AssertsExecutionResults): |
