]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
fixup: try_cast: move test
authorNick Crews <nicholas.b.crews@gmail.com>
Tue, 9 May 2023 19:01:27 +0000 (11:01 -0800)
committerNick Crews <nicholas.b.crews@gmail.com>
Tue, 9 May 2023 19:01:27 +0000 (11:01 -0800)
test/dialect/mssql/test_compiler.py
test/sql/test_compiler.py

index b4b6862c24120acc3094543e72ea78d82d5c84b4..4afcbfd97a8295456cef83abd99b187348b58b9e 100644 (file)
@@ -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),
index 4d0864af9ea5e4e9836ab2fa34dfec0f8d7a98af..ee9388a213aeda1180ce786f81cc2a9a0e51c94a 100644 (file)
@@ -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