| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Looks like we need to either update the test_get_iam_policy_w_invalid_table test to look for ValueError or update _parse_3_part_id to raise TypeError. Based on https://docs.python.org/3/library/exceptions.html#TypeError, I think ValueError is more accurate. ________________ TestClient.test_get_iam_policy_w_invalid_table ________________
self = <tests.unit.test_client.TestClient testMethod=test_get_iam_policy_w_invalid_table>
def test_get_iam_policy_w_invalid_table(self):
creds = _make_credentials()
http = object()
client = self._make_one(project=self.PROJECT, credentials=creds, _http=http)
table_resource_string = "projects/{}/datasets/{}/tables/{}".format(
self.PROJECT, self.DS_ID, self.TABLE_ID,
)
with self.assertRaises(TypeError):
> client.get_iam_policy(table_resource_string)
tests/unit/test_client.py:1558:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
google/cloud/bigquery/client.py:813: in get_iam_policy
table = _table_arg_to_table_ref(table, default_project=self.project)
google/cloud/bigquery/table.py:2666: in _table_arg_to_table_ref
value = TableReference.from_string(value, default_project=default_project)
google/cloud/bigquery/table.py:252: in from_string
) = _helpers._parse_3_part_id(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
def _parse_3_part_id(full_id, default_project=None, property_name="table_id"):
output_project_id = default_project
output_dataset_id = None
output_resource_id = None
parts = _split_id(full_id)
if len(parts) != 2 and len(parts) != 3:
> raise ValueError(
"{property_name} must be a fully-qualified ID in "
'standard SQL format, e.g., "project.dataset.{property_name}", '
"got {}".format(full_id, property_name=property_name)
)
E ValueError: table_id must be a fully-qualified ID in standard SQL format, e.g., "project.dataset.table_id", got projects/PROJECT/datasets/DATASET_ID/tables/TABLE_ID
google/cloud/bigquery/_helpers.py:848: ValueError
|
Sorry, something went wrong.
| raise TypeError("table must be a Table or TableReference") | ||
| table = _table_arg_to_table_ref(table, default_project=self.project) | ||
| if not isinstance(table, (TableReference)): | ||
| raise TypeError( |
There was a problem hiding this comment.
Need unit test that covers this. Possibly this if statement can be deleted if _table_arg_to_table_ref already throws?
Sorry, something went wrong.
| raise TypeError("table must be a Table or TableReference") | ||
| table = _table_arg_to_table_ref(table, default_project=self.project) | ||
| if not isinstance(table, (TableReference)): | ||
| raise TypeError( |
There was a problem hiding this comment.
Line not covered in unit tests
Sorry, something went wrong.
There was a problem hiding this comment.
Ah, got it! Thanks!
Sorry, something went wrong.
| raise TypeError("table must be a Table or TableReference") | ||
| table = _table_arg_to_table_ref(table, default_project=self.project) | ||
| if not isinstance(table, (TableReference)): | ||
| raise TypeError( |
There was a problem hiding this comment.
Line not covered in unit tests
Sorry, something went wrong.
🤖 I have created a release \*beep\* \*boop\* --- ## [2.30.0](https://www.github.com/googleapis/python-bigquery/compare/v2.29.0...v2.30.0) (2021-11-03) ### Features * accept TableListItem where TableReference is accepted ([#1016](https://www.github.com/googleapis/python-bigquery/issues/1016)) ([fe16adc](https://www.github.com/googleapis/python-bigquery/commit/fe16adc86a170d0992c32091b349b036f8b43884)) * support Python 3.10 ([#1043](https://www.github.com/googleapis/python-bigquery/issues/1043)) ([5bbb832](https://www.github.com/googleapis/python-bigquery/commit/5bbb832a83ebb66db4b5ee740cdfc53f4df8430b)) ### Documentation * add code samples for Jupyter/IPython magics ([#1013](https://www.github.com/googleapis/python-bigquery/issues/1013)) ([61141ee](https://www.github.com/googleapis/python-bigquery/commit/61141ee0634024ad261d1595c95cd14a896fb87e)) * **samples:** add create external table with hive partitioning ([#1033](https://www.github.com/googleapis/python-bigquery/issues/1033)) ([d64f5b6](https://www.github.com/googleapis/python-bigquery/commit/d64f5b682854a2293244426316890df4ab1e079e)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
…is#1016) Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [ ] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/python-bigquery/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [ ] Ensure the tests and linter pass - [ ] Code coverage does not decrease (if any source code was changed) - [ ] Appropriate docs were updated (if necessary) 🦕
🤖 I have created a release \*beep\* \*boop\* --- ## [2.30.0](https://www.github.com/googleapis/python-bigquery/compare/v2.29.0...v2.30.0) (2021-11-03) ### Features * accept TableListItem where TableReference is accepted ([googleapis#1016](https://www.github.com/googleapis/python-bigquery/issues/1016)) ([fe16adc](https://www.github.com/googleapis/python-bigquery/commit/fe16adc86a170d0992c32091b349b036f8b43884)) * support Python 3.10 ([googleapis#1043](https://www.github.com/googleapis/python-bigquery/issues/1043)) ([5bbb832](https://www.github.com/googleapis/python-bigquery/commit/5bbb832a83ebb66db4b5ee740cdfc53f4df8430b)) ### Documentation * add code samples for Jupyter/IPython magics ([googleapis#1013](https://www.github.com/googleapis/python-bigquery/issues/1013)) ([61141ee](https://www.github.com/googleapis/python-bigquery/commit/61141ee0634024ad261d1595c95cd14a896fb87e)) * **samples:** add create external table with hive partitioning ([googleapis#1033](https://www.github.com/googleapis/python-bigquery/issues/1033)) ([d64f5b6](https://www.github.com/googleapis/python-bigquery/commit/d64f5b682854a2293244426316890df4ab1e079e)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
| Back | FazBrowse Home | New Git URL |
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
🦕