Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Commit 8075ce5

Browse files
committed
fix cover tests
1 parent 0ae6e09 commit 8075ce5

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

google/cloud/bigquery/schema.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -395,20 +395,16 @@ def _key(self):
395395
Returns:
396396
Tuple: The contents of this :class:`~google.cloud.bigquery.schema.SchemaField`.
397397
"""
398-
field_type = self.field_type.upper() if self.field_type is not None else None
399-
400-
# Type can temporarily be set to None if the code needs a SchemaField instance,
401-
# but has not determined the exact type of the field yet.
402-
if field_type is not None:
403-
if field_type == "STRING" or field_type == "BYTES":
404-
if self.max_length is not None:
405-
field_type = f"{field_type}({self.max_length})"
406-
elif field_type.endswith("NUMERIC"):
407-
if self.precision is not None:
408-
if self.scale is not None:
409-
field_type = f"{field_type}({self.precision}, {self.scale})"
410-
else:
411-
field_type = f"{field_type}({self.precision})"
398+
field_type = self.field_type
399+
if field_type == "STRING" or field_type == "BYTES":
400+
if self.max_length is not None:
401+
field_type = f"{field_type}({self.max_length})"
402+
elif field_type.endswith("NUMERIC"):
403+
if self.precision is not None:
404+
if self.scale is not None:
405+
field_type = f"{field_type}({self.precision}, {self.scale})"
406+
else:
407+
field_type = f"{field_type}({self.precision})"
412408

413409
policy_tags = (
414410
None if self.policy_tags is None else tuple(sorted(self.policy_tags.names))

0 commit comments

Comments
 (0)