From: Nick Crews Date: Tue, 9 May 2023 19:01:27 +0000 (-0800) Subject: fixup: try_cast: move test X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3c6e37ea889ef044b030979a9f05e01d7fd90b95;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git fixup: try_cast: move test --- diff --git a/test/dialect/mssql/test_compiler.py b/test/dialect/mssql/test_compiler.py index b4b6862c24..4afcbfd97a 100644 --- a/test/dialect/mssql/test_compiler.py +++ b/test/dialect/mssql/test_compiler.py @@ -20,7 +20,6 @@ from sqlalchemy import String from sqlalchemy import Table from sqlalchemy import testing from sqlalchemy import text -from sqlalchemy import try_cast from sqlalchemy import union from sqlalchemy import UniqueConstraint from sqlalchemy import update @@ -1473,15 +1472,6 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL): "CREATE INDEX foo ON test (x) INCLUDE (y) WHERE y > 1", ) - def test_try_cast(self): - metadata = MetaData() - t1 = Table("t1", metadata, Column("id", Integer, primary_key=True)) - - self.assert_compile( - select(try_cast(t1.c.id, Integer)), - "SELECT TRY_CAST (t1.id AS INTEGER) AS id FROM t1", - ) - @testing.combinations( ("no_persisted", "", "ignore"), ("persisted_none", "", None), diff --git a/test/sql/test_compiler.py b/test/sql/test_compiler.py index 4d0864af9e..ee9388a213 100644 --- a/test/sql/test_compiler.py +++ b/test/sql/test_compiler.py @@ -57,6 +57,7 @@ from sqlalchemy import Table from sqlalchemy import testing from sqlalchemy import Text from sqlalchemy import text +from sqlalchemy import try_cast from sqlalchemy import TIMESTAMP from sqlalchemy import true from sqlalchemy import tuple_ @@ -6044,6 +6045,15 @@ class StringifySpecialTest(fixtures.TestBase): "ALTER TABLE testtbl ADD EXCLUDE USING gist " "(room WITH =)", ) + def test_try_cast(self): + metadata = MetaData() + t1 = Table("t1", metadata, Column("id", Integer, primary_key=True)) + + self.assert_compile( + select(try_cast(t1.c.id, Integer)), + "SELECT TRY_CAST (t1.id AS INTEGER) AS id FROM t1", + ) + class KwargPropagationTest(fixtures.TestBase): @classmethod