@@ -69,7 +69,7 @@ def test_constructor_explicit(self):
6969 default_value_expression = FIELD_DEFAULT_VALUE_EXPRESSION ,
7070 rounding_mode = enums .RoundingMode .ROUNDING_MODE_UNSPECIFIED ,
7171 foreign_type_definition = "INTEGER" ,
72- timestamp_precision = 6 ,
72+ timestamp_precision = enums . TimestampPrecision . PICOSECOND ,
7373 )
7474 self .assertEqual (field .name , "test" )
7575 self .assertEqual (field .field_type , "STRING" )
@@ -88,7 +88,10 @@ def test_constructor_explicit(self):
8888 )
8989 self .assertEqual (field .rounding_mode , "ROUNDING_MODE_UNSPECIFIED" )
9090 self .assertEqual (field .foreign_type_definition , "INTEGER" )
91- self .assertEqual (field ._properties ["timestampPrecision" ], 6 )
91+ self .assertEqual (
92+ field ._properties ["timestampPrecision" ],
93+ enums .TimestampPrecision .PICOSECOND ,
94+ )
9295
9396 def test_constructor_explicit_none (self ):
9497 field = self ._make_one ("test" , "STRING" , description = None , policy_tags = None )
@@ -196,15 +199,15 @@ def test_to_api_repr_w_timestamp_precision(self):
196199 "foo" ,
197200 "TIMESTAMP" ,
198201 "NULLABLE" ,
199- timestamp_precision = 6 ,
202+ timestamp_precision = enums . TimestampPrecision . PICOSECOND ,
200203 )
201204 self .assertEqual (
202205 field .to_api_repr (),
203206 {
204207 "mode" : "NULLABLE" ,
205208 "name" : "foo" ,
206209 "type" : "TIMESTAMP" ,
207- "timestampPrecision" : 6 ,
210+ "timestampPrecision" : enums . TimestampPrecision . PICOSECOND ,
208211 },
209212 )
210213
@@ -217,7 +220,7 @@ def test_from_api_repr(self):
217220 "name" : "foo" ,
218221 "type" : "record" ,
219222 "roundingMode" : "ROUNDING_MODE_UNSPECIFIED" ,
220- "timestampPrecision" : 6 ,
223+ "timestampPrecision" : enums . TimestampPrecision . PICOSECOND ,
221224 }
222225 )
223226 self .assertEqual (field .name , "foo" )
@@ -230,7 +233,10 @@ def test_from_api_repr(self):
230233 self .assertEqual (field .fields [0 ].mode , "NULLABLE" )
231234 self .assertEqual (field .range_element_type , None )
232235 self .assertEqual (field .rounding_mode , "ROUNDING_MODE_UNSPECIFIED" )
233- self .assertEqual (field ._properties ["timestampPrecision" ], 6 )
236+ self .assertEqual (
237+ field ._properties ["timestampPrecision" ],
238+ enums .TimestampPrecision .PICOSECOND ,
239+ )
234240
235241 def test_from_api_repr_policy (self ):
236242 field = self ._get_target_class ().from_api_repr (
@@ -345,7 +351,7 @@ def test_foreign_type_definition_property_str(self):
345351 self .assertEqual (schema_field .foreign_type_definition , FOREIGN_TYPE_DEFINITION )
346352
347353 def test_timestamp_precision_property (self ):
348- TIMESTAMP_PRECISION = 6
354+ TIMESTAMP_PRECISION = enums . TimestampPrecision . PICOSECOND
349355 schema_field = self ._make_one ("test" , "TIMESTAMP" )
350356 schema_field ._properties ["timestampPrecision" ] = TIMESTAMP_PRECISION
351357 self .assertEqual (schema_field .timestamp_precision , TIMESTAMP_PRECISION )
0 commit comments