[go: nahoru, domu]

Skip to content
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

fix: add types to DatasetReference constructor #1601

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: DatasetReference.from_string test coverage
  • Loading branch information
karelserruys-foodpairing committed Aug 21, 2023
commit 008a317469fd2c55d35dd46f6861d1ef08997ae8
7 changes: 4 additions & 3 deletions google/cloud/bigquery/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,13 @@ def from_string(
)
elif len(parts) == 2:
output_project_id, output_dataset_id = parts
elif len(parts) > 2:
else:
Comment on lines -180 to +182
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here else: covers the same cases as elif len(parts) > 2:

Parameter dataset_id is a string, because of that list parts will always have at least 1 item.
By using else we can reassure pytest-cov that everything is ok.

raise ValueError(
"Too many parts in dataset_id. Expected a fully-qualified "
"dataset ID in standard SQL format. e.g. "
'"project.dataset_id", got {}'.format(dataset_id)
"dataset ID in standard SQL format, "
'e.g. "project.dataset_id", got {}'.format(dataset_id)
)

return cls(output_project_id, output_dataset_id)

def to_api_repr(self) -> dict:
Expand Down