Implement initial Dataset class#31
Implement initial Dataset class#31
Conversation
* Add global_config unset project error * Add two validation functions to utils * Implement initial Dataset class * Lint utils.py
sasha-gitg
left a comment
There was a problem hiding this comment.
Looks great! I really like how you used pytest fixtures for patching.
| if not source: | ||
| return dataset_obj | ||
|
|
||
| return dataset_obj.import_data( |
There was a problem hiding this comment.
This would return an LRO, while in the "no data import" case, we wait until the create_dataset LRO completes. We need to document clearly (e.g. in the docstring) this inconsistent behavior.
There was a problem hiding this comment.
Yeah these multiple LROs under-the-hood can be misleading to the user. I'm adding this discussion to b/171275584
| @pytest.fixture | ||
| def get_dataset_mock(self): | ||
| with patch.object(DatasetServiceClient, "get_dataset") as get_dataset_mock: | ||
| get_dataset_mock.return_value = GapicDataset( |
There was a problem hiding this comment.
this can become difficult to maintain to make sure the mocks return correct responses. we should look into replays.
| reload(aip) | ||
|
|
||
| @pytest.fixture | ||
| def get_dataset_mock(self): |
There was a problem hiding this comment.
perhaps move the mock fixtures into conftest.py so they could be more easily reused.
* Dataset class (#1) * Add global_config unset project error * Add two validation functions to utils * Implement initial Dataset class * Lint utils.py * Address reviewer comments + remove aip alias * Change re.Match to typing.Match * Lint with Py 3.8 * Address flake8 errors, remove unused vars
* Dataset class (#1) * Add global_config unset project error * Add two validation functions to utils * Implement initial Dataset class * Lint utils.py * Address reviewer comments + remove aip alias * Change re.Match to typing.Match * Lint with Py 3.8 * Address flake8 errors, remove unused vars
* Dataset class (#1) * Add global_config unset project error * Add two validation functions to utils * Implement initial Dataset class * Lint utils.py * Address reviewer comments + remove aip alias * Change re.Match to typing.Match * Lint with Py 3.8 * Address flake8 errors, remove unused vars
* Dataset class (#1) * Add global_config unset project error * Add two validation functions to utils * Implement initial Dataset class * Lint utils.py * Address reviewer comments + remove aip alias * Change re.Match to typing.Match * Lint with Py 3.8 * Address flake8 errors, remove unused vars
* Dataset class (#1) * Add global_config unset project error * Add two validation functions to utils * Implement initial Dataset class * Lint utils.py * Address reviewer comments + remove aip alias * Change re.Match to typing.Match * Lint with Py 3.8 * Address flake8 errors, remove unused vars
* Dataset class (#1) * Add global_config unset project error * Add two validation functions to utils * Implement initial Dataset class * Lint utils.py * Address reviewer comments + remove aip alias * Change re.Match to typing.Match * Lint with Py 3.8 * Address flake8 errors, remove unused vars
Summary of changes:
Datasetclass with following methods__init___create_importcreateimport_dataexport_dataDatasetclassutils.py—validate_idandvalidate_string_listprojectis not initialized or set in credentialsFixes b/169781839