From: Miguel Grillo Date: Thu, 24 Oct 2024 17:50:38 +0000 (+0200) Subject: test: refactor test_table_tablespace to use testing.combinations X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6f48988f701b85741a38b0b43c4a26b37f6b81e5;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git test: refactor test_table_tablespace to use testing.combinations Refactored the test_table_tablespace to use testing.combinations for better maintainability and extensibility. This change reduces code repetition and makes it easier to add new test cases in the future. --- diff --git a/test/dialect/oracle/test_compiler.py b/test/dialect/oracle/test_compiler.py index f723896e40..972c60d6e7 100644 --- a/test/dialect/oracle/test_compiler.py +++ b/test/dialect/oracle/test_compiler.py @@ -1659,42 +1659,24 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL): cast(column("foo"), d1), "CAST(foo AS DOUBLE PRECISION)" ) - def test_table_tablespace(self): + @testing.combinations( + ("TEST_TABLESPACE", 'TABLESPACE "TEST_TABLESPACE"'), + ("test_tablespace", "TABLESPACE test_tablespace"), + ("TestTableSpace", 'TABLESPACE "TestTableSpace"'), + argnames="tablespace, expected_sql", + ) + def test_table_tablespace(self, tablespace, expected_sql): m = MetaData() t = Table( "table1", m, Column("x", Integer), - oracle_tablespace="TEST_TABLESPACE", - ) - t2 = Table( - "table2", - m, - Column("x", Integer), - oracle_tablespace="test_tablespace", - ) - t3 = Table( - "table3", - m, - Column("x", Integer), - oracle_tablespace="TestTableSpace", + oracle_tablespace=tablespace, ) self.assert_compile( schema.CreateTable(t), - "CREATE TABLE " - "table1 (x INTEGER) " - 'TABLESPACE "TEST_TABLESPACE"', - ) - self.assert_compile( - schema.CreateTable(t2), - "CREATE TABLE " "table2 (x INTEGER) " "TABLESPACE test_tablespace", - ) - self.assert_compile( - schema.CreateTable(t3), - "CREATE TABLE " - "table3 (x INTEGER) " - 'TABLESPACE "TestTableSpace"', + f"CREATE TABLE table1 (x INTEGER) {expected_sql}", )