44from sqlalchemy .testing .suite import (
55 ComponentReflectionTest as _ComponentReflectionTest ,
66)
7+ from sqlalchemy .testing .suite import (
8+ ComponentReflectionTestExtra as _ComponentReflectionTestExtra ,
9+ )
710from sqlalchemy .testing .suite import HasIndexTest as _HasIndexTest
811from sqlalchemy .testing .suite import HasTableTest as _HasTableTest
912from sqlalchemy .testing .suite import IntegerTest as _IntegerTest
1821)
1922from sqlalchemy .testing .suite import TrueDivTest as _TrueDivTest
2023from sqlalchemy .testing .suite import UnicodeSchemaTest as _UnicodeSchemaTest
24+ import sqlalchemy .types as sql_types
2125
2226
2327class ComponentReflectionTest (_ComponentReflectionTest ):
@@ -242,7 +246,12 @@ def test_get_multi_indexes(self):
242246 {
243247 "column_names" : ["data" ],
244248 "column_sorting" : {"data" : ("nulls_first" ,)},
245- "dialect_options" : {"postgresql_using" : "prefix" },
249+ "dialect_options" : {
250+ "postgresql_ops" : {
251+ "data" : None ,
252+ },
253+ "postgresql_using" : "prefix" ,
254+ },
246255 "duplicates_constraint" : "dingalings_data_key" ,
247256 "name" : "dingalings_data_key" ,
248257 "unique" : True ,
@@ -253,7 +262,13 @@ def test_get_multi_indexes(self):
253262 "address_id" : ("nulls_first" ,),
254263 "dingaling_id" : ("nulls_first" ,),
255264 },
256- "dialect_options" : {"postgresql_using" : "prefix" },
265+ "dialect_options" : {
266+ "postgresql_ops" : {
267+ "address_id" : None ,
268+ "dingaling_id" : None ,
269+ },
270+ "postgresql_using" : "prefix" ,
271+ },
257272 "duplicates_constraint" : "zz_dingalings_multiple" ,
258273 "name" : "zz_dingalings_multiple" ,
259274 "unique" : True ,
@@ -263,7 +278,12 @@ def test_get_multi_indexes(self):
263278 {
264279 "column_names" : ["email_address" ],
265280 "column_sorting" : {"email_address" : ("nulls_first" ,)},
266- "dialect_options" : {"postgresql_using" : "prefix" },
281+ "dialect_options" : {
282+ "postgresql_ops" : {
283+ "email_address" : None ,
284+ },
285+ "postgresql_using" : "prefix" ,
286+ },
267287 "name" : "ix_email_addresses_email_address" ,
268288 "unique" : False ,
269289 }
@@ -273,7 +293,12 @@ def test_get_multi_indexes(self):
273293 {
274294 "column_names" : ["q" ],
275295 "column_sorting" : {"q" : ("desc" , "nulls_last" )},
276- "dialect_options" : {"postgresql_using" : "prefix" },
296+ "dialect_options" : {
297+ "postgresql_ops" : {
298+ "q" : None ,
299+ },
300+ "postgresql_using" : "prefix" ,
301+ },
277302 "name" : "noncol_idx_nopk" ,
278303 "unique" : False ,
279304 }
@@ -282,7 +307,12 @@ def test_get_multi_indexes(self):
282307 {
283308 "column_names" : ["q" ],
284309 "column_sorting" : {"q" : ("desc" , "nulls_last" )},
285- "dialect_options" : {"postgresql_using" : "prefix" },
310+ "dialect_options" : {
311+ "postgresql_ops" : {
312+ "q" : None ,
313+ },
314+ "postgresql_using" : "prefix" ,
315+ },
286316 "name" : "noncol_idx_pk" ,
287317 "unique" : False ,
288318 }
@@ -295,14 +325,27 @@ def test_get_multi_indexes(self):
295325 "test2" : ("nulls_first" ,),
296326 "user_id" : ("nulls_first" ,),
297327 },
298- "dialect_options" : {"postgresql_using" : "prefix" },
328+ "dialect_options" : {
329+ "postgresql_ops" : {
330+ "test1" : None ,
331+ "test2" : None ,
332+ "user_id" : None ,
333+ },
334+ "postgresql_using" : "prefix" ,
335+ },
299336 "name" : "users_all_idx" ,
300337 "unique" : False ,
301338 },
302339 {
303340 "column_names" : ["test1" , "test2" ],
304341 "column_sorting" : {"test1" : ("nulls_first" ,), "test2" : ("nulls_first" ,)},
305- "dialect_options" : {"postgresql_using" : "prefix" },
342+ "dialect_options" : {
343+ "postgresql_ops" : {
344+ "test1" : None ,
345+ "test2" : None ,
346+ },
347+ "postgresql_using" : "prefix" ,
348+ },
306349 "duplicates_constraint" : "users_t_idx" ,
307350 "name" : "users_t_idx" ,
308351 "unique" : True ,
@@ -378,6 +421,19 @@ def test_not_existing_table(self):
378421 pass
379422
380423
424+ class ComponentReflectionTestExtra (_ComponentReflectionTestExtra ):
425+ @testing .combinations (
426+ sql_types .String ,
427+ sql_types .VARCHAR ,
428+ # sql_types.CHAR, # we return VARCHAR(length=52)
429+ (sql_types .NVARCHAR , testing .requires .nvarchar_types ),
430+ (sql_types .NCHAR , testing .requires .nvarchar_types ),
431+ argnames = "type_" ,
432+ )
433+ def test_string_length_reflection (self , connection , metadata , type_ ):
434+ super ().test_string_length_reflection (connection , metadata , type_ , [])
435+
436+
381437class HasIndexTest (_HasIndexTest ):
382438 @skip ("cockroachdb" )
383439 def test_has_index (self ):
0 commit comments