diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2023-02-15 18:28:12 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2023-02-15 18:28:12 -0500 |
| commit | 8855656626202e541bd2c95bc023e820a022322f (patch) | |
| tree | 9ab6972e392f51d53c23c10098ce7a7e1a1ee679 /lib/sqlalchemy/testing | |
| parent | 59d357b8ea23ce645747b5f3f221365b76504d8c (diff) | |
| download | sqlalchemy-8855656626202e541bd2c95bc023e820a022322f.tar.gz | |
prevent float tests from running on asyncmy
asyncmy 0.2.7 has had a loss in float precision for even
very low numbers of significant digits.
Change-Id: Iec6d2650943eeaa8e854f21990f6565d73331f8c
References: https://github.com/long2ice/asyncmy/issues/56
Diffstat (limited to 'lib/sqlalchemy/testing')
| -rw-r--r-- | lib/sqlalchemy/testing/requirements.py | 14 | ||||
| -rw-r--r-- | lib/sqlalchemy/testing/suite/test_types.py | 6 |
2 files changed, 16 insertions, 4 deletions
diff --git a/lib/sqlalchemy/testing/requirements.py b/lib/sqlalchemy/testing/requirements.py index 6e325ea66..9bfc94e78 100644 --- a/lib/sqlalchemy/testing/requirements.py +++ b/lib/sqlalchemy/testing/requirements.py @@ -1179,6 +1179,20 @@ class SuiteRequirements(Requirements): return exclusions.open() @property + def literal_float_coercion(self): + """target backend will return the exact float value 15.7563 + with only four significant digits from this statement: + + SELECT :param + + where :param is the Python float 15.7563 + + i.e. it does not return 15.75629997253418 + + """ + return exclusions.open() + + @property def floats_to_four_decimals(self): """target backend can return a floating-point number with four significant digits (such as 15.7563) accurately diff --git a/lib/sqlalchemy/testing/suite/test_types.py b/lib/sqlalchemy/testing/suite/test_types.py index 36fd7f247..d6a74b220 100644 --- a/lib/sqlalchemy/testing/suite/test_types.py +++ b/lib/sqlalchemy/testing/suite/test_types.py @@ -945,6 +945,7 @@ class NumericTest(_LiteralRoundTripFixture, fixtures.TestBase): filter_=lambda n: n is not None and round(n, 5) or None, ) + @testing.requires.literal_float_coercion def test_float_coerce_round_trip(self, connection): expr = 15.7563 @@ -1199,10 +1200,7 @@ class JSONTest(_LiteralRoundTripFixture, fixtures.TablesTest): ("integer", None), ("float", 28.5), ("float", None), - ( - "float", - 1234567.89, - ), + ("float", 1234567.89, testing.requires.literal_float_coercion), ("numeric", 1234567.89), # this one "works" because the float value you see here is # lost immediately to floating point stuff |
