Skip to content

Commit 100708d

Browse files
Fix: add roundingmode as str test (#2098)
* fix: adds test of roundingmode as a str * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 94a39b4 commit 100708d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

google/cloud/bigquery/schema.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -259,11 +259,10 @@ def __init__(
259259
if self._properties.get("foreignTypeDefinition") is None:
260260
raise ValueError(
261261
"If the 'field_type' is 'FOREIGN', then 'foreign_type_definition' is required."
262-
)
262+
)
263263
if fields: # Don't set the property if it's not set.
264264
self._properties["fields"] = [field.to_api_repr() for field in fields]
265265

266-
267266
@classmethod
268267
def from_api_repr(cls, api_repr: dict) -> "SchemaField":
269268
"""Return a ``SchemaField`` object deserialized from a dictionary.

tests/unit/test_schema.py

+5
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,11 @@ def test_fields_property(self):
314314
schema_field = self._make_one("boat", "RECORD", fields=fields)
315315
self.assertEqual(schema_field.fields, fields)
316316

317+
def test_roundingmode_property_str(self):
318+
ROUNDINGMODE = "ROUNDING_MODE_UNSPECIFIED"
319+
schema_field = self._make_one("test", "STRING", rounding_mode=ROUNDINGMODE)
320+
self.assertEqual(schema_field.rounding_mode, ROUNDINGMODE)
321+
317322
def test_to_standard_sql_simple_type(self):
318323
examples = (
319324
# a few legacy types

0 commit comments

Comments
 (0)