-
Notifications
You must be signed in to change notification settings - Fork 322
feat: adds ForeignTypeInfo test #2076
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
561a97b
be6d15d
51ff9cb
e3f25eb
e762133
6830e40
1649182
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,7 +16,7 @@ | |
| from google.cloud.bigquery.standard_sql import StandardSqlStructType | ||
| from google.cloud.bigquery.schema import ( | ||
| PolicyTagList, | ||
| # ForeignTypeInfo, | ||
| ForeignTypeInfo, | ||
| StorageDescriptor, | ||
| SerDeInfo, | ||
| ) | ||
|
|
@@ -1121,8 +1121,6 @@ class TestForeignTypeInfo: | |
|
|
||
| @staticmethod | ||
| def _get_target_class(): | ||
| from google.cloud.bigquery.schema import ForeignTypeInfo | ||
|
|
||
| return ForeignTypeInfo | ||
|
|
||
| def _make_one(self, *args, **kw): | ||
|
|
@@ -1160,6 +1158,22 @@ def test_to_api_repr(self, type_system, expected): | |
| result = self._make_one(type_system=type_system) | ||
| assert result.to_api_repr() == expected | ||
|
|
||
| def test_from_api_repr(self): | ||
| """GIVEN an api representation of a ForeignTypeInfo object (i.e. resource) | ||
| WHEN converted into a ForeignTypeInfo object using from_api_repr() and | ||
| displayed as a dict | ||
| THEN it will have the same representation a ForeignTypeInfo object created | ||
| directly (via _make_one()) and displayed as a dict. | ||
| """ | ||
| resource = {"typeSystem": "TYPE_SYSTEM_UNSPECIFIED"} | ||
|
|
||
| expected = self._make_one(type_system="TYPE_SYSTEM_UNSPECIFIED") | ||
|
|
||
| klass = self._get_target_class() | ||
| result = klass.from_api_repr(resource) | ||
|
|
||
| assert result.to_api_repr() == expected.to_api_repr() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar feedback to the other CL, though maybe though now I'm thinking maybe we need to test that from_api_repr has the same response, though since to_api_repr is tested I think this is actually ok. Your doc comment does describe that the results we are comparing are displayed as a dict, maybe its just the test naming that is throwing it off for me (maybe test_convert_api_repr or something?). Either way do think its fine to leave as is. |
||
|
|
||
|
|
||
| class TestStorageDescriptor: | ||
| """Tests for the StorageDescriptor class.""" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: with this much removed code that isnt relevant to the change, it would probably make sense to have that as a separate PR (for next time don't need to move it now)