@@ -160,10 +160,16 @@ def test_fields_property(self):
160160 def test_to_standard_sql_simple_type (self ):
161161 sql_type = self ._get_standard_sql_data_type_class ()
162162 examples = (
163+ # a few legacy types
163164 ("INTEGER" , sql_type .INT64 ),
164165 ("FLOAT" , sql_type .FLOAT64 ),
165166 ("BOOLEAN" , sql_type .BOOL ),
166167 ("DATETIME" , sql_type .DATETIME ),
168+ # a few standard types
169+ ("INT64" , sql_type .INT64 ),
170+ ("FLOAT64" , sql_type .FLOAT64 ),
171+ ("BOOL" , sql_type .BOOL ),
172+ ("GEOGRAPHY" , sql_type .GEOGRAPHY ),
167173 )
168174 for legacy_type , standard_type in examples :
169175 field = self ._make_one ("some_field" , legacy_type )
@@ -172,7 +178,7 @@ def test_to_standard_sql_simple_type(self):
172178 self .assertEqual (standard_field .type .type_kind , standard_type )
173179 self .assertFalse (standard_field .type .HasField ("sub_type" ))
174180
175- def test_to_standard_sql_complex_type (self ):
181+ def test_to_standard_sql_struct_type (self ):
176182 from google .cloud .bigquery_v2 import types
177183
178184 # Expected result object:
@@ -240,13 +246,13 @@ def test_to_standard_sql_complex_type(self):
240246 "last_used" , "RECORD" , fields = (sub_sub_field1 , sub_sub_field2 )
241247 )
242248 sub_field_bytes = self ._make_one ("image_content" , "BYTES" )
243- schema_field = self ._make_one (
244- "image_usage" , "RECORD" , fields = (sub_field_bytes , sub_field_record )
245- )
246-
247- standard_field = schema_field .to_standard_sql ()
248249
249- self .assertEqual (standard_field , expected_result )
250+ for type_name in ("RECORD" , "STRUCT" ):
251+ schema_field = self ._make_one (
252+ "image_usage" , type_name , fields = (sub_field_bytes , sub_field_record )
253+ )
254+ standard_field = schema_field .to_standard_sql ()
255+ self .assertEqual (standard_field , expected_result )
250256
251257 def test_to_standard_sql_unknown_type (self ):
252258 sql_type = self ._get_standard_sql_data_type_class ()
0 commit comments