4
4
from sqlalchemy .testing .suite import (
5
5
ComponentReflectionTest as _ComponentReflectionTest ,
6
6
)
7
+ from sqlalchemy .testing .suite import (
8
+ ComponentReflectionTestExtra as _ComponentReflectionTestExtra ,
9
+ )
7
10
from sqlalchemy .testing .suite import HasIndexTest as _HasIndexTest
8
11
from sqlalchemy .testing .suite import HasTableTest as _HasTableTest
9
12
from sqlalchemy .testing .suite import IntegerTest as _IntegerTest
18
21
)
19
22
from sqlalchemy .testing .suite import TrueDivTest as _TrueDivTest
20
23
from sqlalchemy .testing .suite import UnicodeSchemaTest as _UnicodeSchemaTest
24
+ import sqlalchemy .types as sql_types
21
25
22
26
23
27
class ComponentReflectionTest (_ComponentReflectionTest ):
@@ -242,7 +246,12 @@ def test_get_multi_indexes(self):
242
246
{
243
247
"column_names" : ["data" ],
244
248
"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
+ },
246
255
"duplicates_constraint" : "dingalings_data_key" ,
247
256
"name" : "dingalings_data_key" ,
248
257
"unique" : True ,
@@ -253,7 +262,13 @@ def test_get_multi_indexes(self):
253
262
"address_id" : ("nulls_first" ,),
254
263
"dingaling_id" : ("nulls_first" ,),
255
264
},
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
+ },
257
272
"duplicates_constraint" : "zz_dingalings_multiple" ,
258
273
"name" : "zz_dingalings_multiple" ,
259
274
"unique" : True ,
@@ -263,7 +278,12 @@ def test_get_multi_indexes(self):
263
278
{
264
279
"column_names" : ["email_address" ],
265
280
"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
+ },
267
287
"name" : "ix_email_addresses_email_address" ,
268
288
"unique" : False ,
269
289
}
@@ -273,7 +293,12 @@ def test_get_multi_indexes(self):
273
293
{
274
294
"column_names" : ["q" ],
275
295
"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
+ },
277
302
"name" : "noncol_idx_nopk" ,
278
303
"unique" : False ,
279
304
}
@@ -282,7 +307,12 @@ def test_get_multi_indexes(self):
282
307
{
283
308
"column_names" : ["q" ],
284
309
"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
+ },
286
316
"name" : "noncol_idx_pk" ,
287
317
"unique" : False ,
288
318
}
@@ -295,14 +325,27 @@ def test_get_multi_indexes(self):
295
325
"test2" : ("nulls_first" ,),
296
326
"user_id" : ("nulls_first" ,),
297
327
},
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
+ },
299
336
"name" : "users_all_idx" ,
300
337
"unique" : False ,
301
338
},
302
339
{
303
340
"column_names" : ["test1" , "test2" ],
304
341
"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
+ },
306
349
"duplicates_constraint" : "users_t_idx" ,
307
350
"name" : "users_t_idx" ,
308
351
"unique" : True ,
@@ -378,6 +421,19 @@ def test_not_existing_table(self):
378
421
pass
379
422
380
423
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
+
381
437
class HasIndexTest (_HasIndexTest ):
382
438
@skip ("cockroachdb" )
383
439
def test_has_index (self ):
0 commit comments