feat(bigquery): make rowIterator._to_dataframe_iterable public#10017
Merged
tswast merged 3 commits intogoogleapis:masterfrom Jan 10, 2020
Merged
Conversation
tswast
reviewed
Dec 26, 2019
bigquery/tests/unit/test_table.py
Outdated
| row_iterator = self._make_one( | ||
| _mock_client(), api_request, path, schema, page_size=1, max_results=5 | ||
| ) | ||
| df = row_iterator.to_dataframe_iterable() |
Contributor
There was a problem hiding this comment.
Since this is a generator, use a plural for the variable name dfs or dataframes.
bigquery/tests/unit/test_table.py
Outdated
|
|
||
| self.assertIsInstance(df, types.GeneratorType) | ||
|
|
||
| a = next(df) |
Contributor
There was a problem hiding this comment.
a is a Pandas DataFrame, so df or dataframe would be a more appropriate name.
bigquery/tests/unit/test_table.py
Outdated
| {"f": [{"v": "Bhettye Rhubble"}, {"v": "27"}]}, | ||
| ] | ||
| path = "/foo" | ||
| api_request = mock.Mock(return_value={"rows": rows}) |
Contributor
There was a problem hiding this comment.
I'd like to see side_effect used to test with multiple pages.
bigquery/tests/unit/test_table.py
Outdated
| api_request = mock.Mock(return_value={"rows": rows}) | ||
| row_iterator = self._make_one(_mock_client(), api_request, path, schema) | ||
|
|
||
| with self.assertRaises(ValueError): |
Contributor
There was a problem hiding this comment.
Let's use pytest.raises and match="pandas" to make sure that the ValueError occurs because of the missing pandas dependency.
tswast
previously approved these changes
Dec 27, 2019
tswast
reviewed
Dec 27, 2019
bigquery/tests/unit/test_table.py
Outdated
| self.assertEqual(df_1.age.dtype.name, "int64") | ||
| self.assertEqual(len(df_1), 1) # verify the number of rows | ||
| self.assertEqual( | ||
| df_1.name._get_value(0), "Bengt" |
Contributor
There was a problem hiding this comment.
Why use _get_value(0) instead of df_1["name"][0]?
Concerned about use of private _get_value in unit tests.
Contributor
Author
|
@tswast PTAL. |
tswast
approved these changes
Jan 10, 2020
This was referenced Jan 29, 2020
Merged
Merged
This was referenced Jan 29, 2020
[CHANGE ME] Re-generated container to pick up changes in the API or client library generator.
#10256
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #7339