]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
prevent float tests from running on asyncmy
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 15 Feb 2023 23:28:12 +0000 (18:28 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 27 Feb 2023 13:18:17 +0000 (08:18 -0500)
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
(cherry picked from commit 8855656626202e541bd2c95bc023e820a022322f)

lib/sqlalchemy/testing/requirements.py
lib/sqlalchemy/testing/suite/test_types.py
test/dialect/mysql/test_types.py
test/requirements.py

index 0e8eec52d69ea43d05fbe0e7443be75fa34e79bf..0b2e059d0a14446d4c0268d05aaf5a9c55921cc7 100644 (file)
@@ -1043,6 +1043,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
index b96350ed077abb48cf3f3b55a101ce34ab38cb7e..6dc508957523fd9a533f2af9b7867a43eeb6a9f2 100644 (file)
@@ -692,6 +692,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
 
@@ -941,10 +942,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
index 017fad3cff626110382fb1f631d0eb8b79ee2e9e..358b814b92f4db6ca371d9478dd870ac0378917a 100644 (file)
@@ -474,6 +474,8 @@ class TypeRoundTripTest(fixtures.TestBase, AssertsExecutionResults):
 
     # fixed in mysql-connector as of 2.0.1,
     # see https://bugs.mysql.com/bug.php?id=73266
+
+    @testing.requires.literal_float_coercion
     def test_precision_float_roundtrip(self, metadata, connection):
         t = Table(
             "t",
index fa9ba88f58f8e77fb1c4e9003487ddc8e7dae3e6..47f5c49eb34b4b587d96af06b16861c7676b761c 100644 (file)
@@ -1360,6 +1360,10 @@ class DefaultRequirements(SuiteRequirements):
             ]
         )
 
+    @property
+    def literal_float_coercion(self):
+        return skip_if("+asyncmy")
+
     @property
     def infinity_floats(self):
         return fails_on_everything_except(