summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/testing
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2021-11-02 18:19:35 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2021-11-02 22:16:54 -0400
commit9fa79bb53638e02aaa45d77397b39a1b652ba5f1 (patch)
tree8001245d8cb588082884e3078aa943850323ea07 /lib/sqlalchemy/testing
parent37bc1285c5bddf1e1b3a5830c530139e6fdd4bc4 (diff)
downloadsqlalchemy-9fa79bb53638e02aaa45d77397b39a1b652ba5f1.tar.gz
map Float to asyncpg.FLOAT, test for infinity
Fixes: #7283 Change-Id: I5402a72617b7f9bc366d64bc5ce8669374839984
Diffstat (limited to 'lib/sqlalchemy/testing')
-rw-r--r--lib/sqlalchemy/testing/requirements.py6
-rw-r--r--lib/sqlalchemy/testing/suite/test_types.py10
2 files changed, 16 insertions, 0 deletions
diff --git a/lib/sqlalchemy/testing/requirements.py b/lib/sqlalchemy/testing/requirements.py
index 8b385b5d2..08acbd2d2 100644
--- a/lib/sqlalchemy/testing/requirements.py
+++ b/lib/sqlalchemy/testing/requirements.py
@@ -981,6 +981,12 @@ class SuiteRequirements(Requirements):
return exclusions.closed()
@property
+ def infinity_floats(self):
+ """The Float type can persist and load float('inf'), float('-inf')."""
+
+ return exclusions.closed()
+
+ @property
def precision_generic_float_type(self):
"""target backend will return native floating point numbers with at
least seven decimal places when using the generic Float type.
diff --git a/lib/sqlalchemy/testing/suite/test_types.py b/lib/sqlalchemy/testing/suite/test_types.py
index 93d37d4d5..7438b8bc8 100644
--- a/lib/sqlalchemy/testing/suite/test_types.py
+++ b/lib/sqlalchemy/testing/suite/test_types.py
@@ -590,6 +590,16 @@ class NumericTest(_LiteralRoundTripFixture, fixtures.TestBase):
[15.7563],
)
+ @testing.requires.infinity_floats
+ def test_infinity_floats(self, do_numeric_test):
+ """test for #977, #7283"""
+
+ do_numeric_test(
+ Float(None),
+ [float("inf")],
+ [float("inf")],
+ )
+
@testing.requires.fetch_null_from_numeric
def test_numeric_null_as_decimal(self, do_numeric_test):
do_numeric_test(Numeric(precision=8, scale=4), [None], [None])