@@ -97,47 +97,47 @@ def setUp(self):
97
97
graphql_schema , type_equivalence_hints , dialect , vertex_name_to_table , join_descriptors
98
98
)
99
99
100
- def test_table_vertex_representation (self ):
100
+ def test_table_vertex_representation (self ) -> None :
101
101
self .assertIsInstance (self .schema_info .schema .get_type ("Table1" ), GraphQLObjectType )
102
102
103
- def test_table_vertex_representation_with_non_default_name (self ):
103
+ def test_table_vertex_representation_with_non_default_name (self ) -> None :
104
104
self .assertIsInstance (
105
105
self .schema_info .schema .get_type ("ArbitraryObjectName" ), GraphQLObjectType
106
106
)
107
107
108
- def test_represent_supported_fields (self ):
108
+ def test_represent_supported_fields (self ) -> None :
109
109
table1_graphql_object = self .schema_info .schema .get_type ("Table1" )
110
110
self .assertEqual (
111
111
table1_graphql_object .fields ["column_with_supported_type" ].type , GraphQLString
112
112
)
113
113
114
- def test_ignored_fields_not_supported (self ):
114
+ def test_ignored_fields_not_supported (self ) -> None :
115
115
table1_graphql_object = self .schema_info .schema .get_type ("Table1" )
116
116
self .assertTrue ("column_with_non_supported_type" not in table1_graphql_object .fields )
117
117
118
- def test_warn_when_type_is_not_supported (self ):
118
+ def test_warn_when_type_is_not_supported (self ) -> None :
119
119
with pytest .warns (Warning ):
120
120
try_get_graphql_scalar_type ("binary" , LargeBinary ())
121
121
122
- def test_support_sql_tz_naive_datetime_types (self ):
122
+ def test_support_sql_tz_naive_datetime_types (self ) -> None :
123
123
column_name = "tz_naive_datetime"
124
124
tz_naive_types = (DateTime (timezone = False ), TIMESTAMP (timezone = False ))
125
125
for sql_type in tz_naive_types :
126
126
self .assertEqual (GraphQLDateTime , try_get_graphql_scalar_type (column_name , sql_type ))
127
127
128
- def test_do_not_support_sql_tz_aware_datetime_types (self ):
128
+ def test_do_not_support_sql_tz_aware_datetime_types (self ) -> None :
129
129
column_name = "tz_aware_datetime"
130
130
tz_aware_types = (DateTime (timezone = True ), TIMESTAMP (timezone = True ))
131
131
for sql_type in tz_aware_types :
132
132
with self .assertWarns (Warning ):
133
133
graphql_type = try_get_graphql_scalar_type (column_name , sql_type )
134
134
self .assertIsNone (graphql_type )
135
135
136
- def test_mssql_scalar_type_representation (self ):
136
+ def test_mssql_scalar_type_representation (self ) -> None :
137
137
table1_graphql_object = self .schema_info .schema .get_type ("Table1" )
138
138
self .assertEqual (table1_graphql_object .fields ["column_with_mssql_type" ].type , GraphQLInt )
139
139
140
- def test_direct_sql_edge_representation (self ):
140
+ def test_direct_sql_edge_representation (self ) -> None :
141
141
table1_graphql_object = self .schema_info .schema .get_type ("Table1" )
142
142
arbitrarily_named_graphql_object = self .schema_info .schema .get_type ("ArbitraryObjectName" )
143
143
self .assertEqual (
@@ -147,7 +147,7 @@ def test_direct_sql_edge_representation(self):
147
147
arbitrarily_named_graphql_object .fields ["in_test_edge" ].type .of_type .name , "Table1"
148
148
)
149
149
150
- def test_get_join_descriptors (self ):
150
+ def test_get_join_descriptors (self ) -> None :
151
151
expected_join_descriptors = {
152
152
"Table1" : {
153
153
"out_test_edge" : DirectJoinDescriptor ("source_column" , "destination_column" )
@@ -158,7 +158,7 @@ def test_get_join_descriptors(self):
158
158
}
159
159
self .assertEqual (expected_join_descriptors , self .schema_info .join_descriptors )
160
160
161
- def test_basic_index_generation_from_primary_key (self ):
161
+ def test_basic_index_generation_from_primary_key (self ) -> None :
162
162
indexes = self .schema_graph .get_all_indexes_for_class ("Table1" )
163
163
self .assertIn (
164
164
IndexDefinition (
@@ -172,7 +172,7 @@ def test_basic_index_generation_from_primary_key(self):
172
172
indexes ,
173
173
)
174
174
175
- def test_index_generation_from_multi_column_primary_key (self ):
175
+ def test_index_generation_from_multi_column_primary_key (self ) -> None :
176
176
indexes = self .schema_graph .get_all_indexes_for_class ("TableWithMultiplePrimaryKeyColumns" )
177
177
self .assertEqual (
178
178
{
@@ -188,11 +188,11 @@ def test_index_generation_from_multi_column_primary_key(self):
188
188
indexes ,
189
189
)
190
190
191
- def test_index_generation_from_primary_key_with_an_unsupported_column_type (self ):
191
+ def test_index_generation_from_primary_key_with_an_unsupported_column_type (self ) -> None :
192
192
indexes = self .schema_graph .get_all_indexes_for_class ("TableWithNonSupportedPrimaryKeyType" )
193
193
self .assertEqual (frozenset (), indexes )
194
194
195
- def test_index_generation_from_unique_constraint (self ):
195
+ def test_index_generation_from_unique_constraint (self ) -> None :
196
196
indexes = self .schema_graph .get_all_indexes_for_class ("Table1" )
197
197
self .assertIn (
198
198
IndexDefinition (
@@ -209,7 +209,7 @@ def test_index_generation_from_unique_constraint(self):
209
209
210
210
@pytest .mark .filterwarnings ("ignore: Ignored .* edges implied by composite foreign keys.*" )
211
211
class SQLAlchemyForeignKeyEdgeGenerationTests (unittest .TestCase ):
212
- def test_edge_generation_from_foreign_keys (self ):
212
+ def test_edge_generation_from_foreign_keys (self ) -> None :
213
213
metadata = MetaData ()
214
214
215
215
table1 = Table (
@@ -242,7 +242,7 @@ def test_edge_generation_from_foreign_keys(self):
242
242
},
243
243
)
244
244
245
- def test_warning_for_ignored_foreign_keys (self ):
245
+ def test_warning_for_ignored_foreign_keys (self ) -> None :
246
246
metadata = MetaData ()
247
247
248
248
table1 = Table (
@@ -281,7 +281,7 @@ class SQLAlchemySchemaInfoGenerationErrorTests(unittest.TestCase):
281
281
def setUp (self ):
282
282
self .vertex_name_to_table = _get_test_vertex_name_to_table ()
283
283
284
- def test_reference_to_non_existent_source_vertex (self ):
284
+ def test_reference_to_non_existent_source_vertex (self ) -> None :
285
285
direct_edges = {
286
286
"invalid_source_vertex" : DirectEdgeDescriptor (
287
287
"InvalidVertexName" , "source_column" , "ArbitraryObjectName" , "destination_column"
@@ -290,7 +290,7 @@ def test_reference_to_non_existent_source_vertex(self):
290
290
with self .assertRaises (InvalidSQLEdgeError ):
291
291
get_sqlalchemy_schema_info (self .vertex_name_to_table , direct_edges , dialect ())
292
292
293
- def test_reference_to_non_existent_destination_vertex (self ):
293
+ def test_reference_to_non_existent_destination_vertex (self ) -> None :
294
294
direct_edges = {
295
295
"invalid_source_vertex" : DirectEdgeDescriptor (
296
296
"Table1" , "source_column" , "InvalidVertexName" , "destination_column"
@@ -299,7 +299,7 @@ def test_reference_to_non_existent_destination_vertex(self):
299
299
with self .assertRaises (InvalidSQLEdgeError ):
300
300
get_sqlalchemy_schema_info (self .vertex_name_to_table , direct_edges , dialect ())
301
301
302
- def test_reference_to_non_existent_source_column (self ):
302
+ def test_reference_to_non_existent_source_column (self ) -> None :
303
303
direct_edges = {
304
304
"invalid_source_vertex" : DirectEdgeDescriptor (
305
305
"Table1" , "invalid_column_name" , "ArbitraryObjectName" , "destination_column"
@@ -308,7 +308,7 @@ def test_reference_to_non_existent_source_column(self):
308
308
with self .assertRaises (InvalidSQLEdgeError ):
309
309
get_sqlalchemy_schema_info (self .vertex_name_to_table , direct_edges , dialect ())
310
310
311
- def test_reference_to_non_existent_destination_column (self ):
311
+ def test_reference_to_non_existent_destination_column (self ) -> None :
312
312
direct_edges = {
313
313
"invalid_destination_column" : DirectEdgeDescriptor (
314
314
"Table1" , "source_column" , "ArbitraryObjectName" , "invalid_column_name"
@@ -317,15 +317,15 @@ def test_reference_to_non_existent_destination_column(self):
317
317
with self .assertRaises (InvalidSQLEdgeError ):
318
318
get_sqlalchemy_schema_info (self .vertex_name_to_table , direct_edges , dialect ())
319
319
320
- def test_missing_primary_key (self ):
320
+ def test_missing_primary_key (self ) -> None :
321
321
table_without_primary_key = Table (
322
322
"TableWithoutPrimaryKey" , MetaData (), Column ("arbitrary_column" , String ()),
323
323
)
324
324
faulty_vertex_name_to_table = {table_without_primary_key .name : table_without_primary_key }
325
325
with self .assertRaises (MissingPrimaryKeyError ):
326
326
get_sqlalchemy_schema_info (faulty_vertex_name_to_table , {}, dialect ())
327
327
328
- def test_missing_multiple_primary_keys (self ):
328
+ def test_missing_multiple_primary_keys (self ) -> None :
329
329
metadata : MetaData = MetaData ()
330
330
table_without_primary_key : Table = Table (
331
331
"TableWithoutPrimaryKey" , metadata , Column ("arbitrary_column" , String ()),
0 commit comments