@@ -1061,9 +1061,33 @@ def test_column_name_character_map_none(self):
10611061 "parquetOptions" : {"enableListInference" : True },
10621062 "columnNameCharacterMap" : "V2" ,
10631063 "someNewField" : "some-value" ,
1064+ "timestampTargetPrecision" : [6 , 12 ],
10641065 }
10651066 }
10661067
1068+ def test_timestamp_target_precision_missing (self ):
1069+ config = self ._get_target_class ()()
1070+ self .assertIsNone (config .timestamp_target_precision )
1071+
1072+ def test_timestamp_target_precision_hit (self ):
1073+ timestamp_target_precision = [6 , 12 ]
1074+ config = self ._get_target_class ()()
1075+ config ._properties ["load" ]["timestampTargetPrecision" ] = timestamp_target_precision
1076+ self .assertEqual (config .timestamp_target_precision , timestamp_target_precision )
1077+
1078+ def test_timestamp_target_precision_setter (self ):
1079+ timestamp_target_precision = [6 , 12 ]
1080+ config = self ._get_target_class ()()
1081+ config .timestamp_target_precision = timestamp_target_precision
1082+ self .assertEqual (config ._properties ["load" ]["timestampTargetPrecision" ], timestamp_target_precision )
1083+
1084+ def test_timestamp_target_precision_setter_w_none (self ):
1085+ timestamp_target_precision = [6 , 12 ]
1086+ config = self ._get_target_class ()()
1087+ config ._properties ["load" ]["timestampTargetPrecision" ] = timestamp_target_precision
1088+ config .timestamp_target_precision = None
1089+ self .assertFalse ("timestampTargetPrecision" in config ._properties ["load" ])
1090+
10671091 def test_from_api_repr (self ):
10681092 from google .cloud .bigquery .job import (
10691093 CreateDisposition ,
@@ -1103,6 +1127,7 @@ def test_from_api_repr(self):
11031127 self .assertTrue (config .parquet_options .enable_list_inference )
11041128 self .assertEqual (config .column_name_character_map , ColumnNameCharacterMap .V2 )
11051129 self .assertEqual (config ._properties ["load" ]["someNewField" ], "some-value" )
1130+ self .assertEqual (config .timestamp_target_precision , [6 , 12 ])
11061131
11071132 def test_to_api_repr (self ):
11081133 from google .cloud .bigquery .job import (
@@ -1140,6 +1165,7 @@ def test_to_api_repr(self):
11401165 config .parquet_options = parquet_options
11411166 config .column_name_character_map = ColumnNameCharacterMap .V2
11421167 config ._properties ["load" ]["someNewField" ] = "some-value"
1168+ config .timestamp_target_precision = [6 , 12 ]
11431169
11441170 api_repr = config .to_api_repr ()
11451171
0 commit comments