]> 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>
Wed, 15 Feb 2023 23:28:12 +0000 (18:28 -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

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

index 6e325ea663ff35c90ad7fa1b87cfbb5ebf25073a..9bfc94e78a583e2b92bd3a91e8a75799722be0de 100644 (file)
@@ -1178,6 +1178,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 36fd7f247c9decbb4d589d7bc0533bb6a7128cdc..d6a74b220c4497f8abc5b30187678a8239d7ffc1 100644 (file)
@@ -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
index eca1051e213ce9d71b23f7eaad04b2b5576bfdd1..989d50d49427c47ded01a1c1b00b7e23b59c1c07 100644 (file)
@@ -471,6 +471,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 d91f056732d160ff32944576c2b21423b86041a8..923d98b4626a2e70a97515192c077add9091a226 100644 (file)
@@ -1333,6 +1333,10 @@ class DefaultRequirements(SuiteRequirements):
             "sqlite doesn't return Decimal objects without special handlers",
         )
 
+    @property
+    def literal_float_coercion(self):
+        return skip_if("+asyncmy")
+
     @property
     def infinity_floats(self):
         return fails_on_everything_except(