diff options
Diffstat (limited to 'test/dialect/mssql/test_compiler.py')
-rw-r--r-- | test/dialect/mssql/test_compiler.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/dialect/mssql/test_compiler.py b/test/dialect/mssql/test_compiler.py index 00a8a08fc..6b3244c30 100644 --- a/test/dialect/mssql/test_compiler.py +++ b/test/dialect/mssql/test_compiler.py @@ -1,5 +1,6 @@ # -*- encoding: utf-8 from sqlalchemy import Column +from sqlalchemy import Computed from sqlalchemy import delete from sqlalchemy import extract from sqlalchemy import func @@ -1193,6 +1194,27 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL): "SELECT TRY_CAST (t1.id AS INTEGER) AS id FROM t1", ) + @testing.combinations( + ("no_persisted", "", "ignore"), + ("persisted_none", "", None), + ("persisted_true", " PERSISTED", True), + ("persisted_false", "", False), + id_="iaa", + ) + def test_column_computed(self, text, persisted): + m = MetaData() + kwargs = {"persisted": persisted} if persisted != "ignore" else {} + t = Table( + "t", + m, + Column("x", Integer), + Column("y", Integer, Computed("x + 2", **kwargs)), + ) + self.assert_compile( + schema.CreateTable(t), + "CREATE TABLE t (x INTEGER NULL, y AS (x + 2)%s)" % text, + ) + class SchemaTest(fixtures.TestBase): def setup(self): |