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

Test get_dataset_config_info with non-existing/gated/private dataset #7124

Merged
merged 2 commits into from
Aug 26, 2024
Merged
Changes from all commits
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
12 changes: 10 additions & 2 deletions tests/test_inspect.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pytest

from datasets.exceptions import DatasetNotFoundError
from datasets.inspect import (
get_dataset_config_info,
get_dataset_config_names,
Expand Down Expand Up @@ -35,11 +36,18 @@ def test_get_dataset_config_info_private(hf_token, hf_private_dataset_repo_txt_d
"path, config_name, expected_exception",
[
("paws", None, ValueError),
# non-existing, gated, private:
("hf-internal-testing/non-existing-dataset", "default", DatasetNotFoundError),
("hf-internal-testing/gated_dataset_with_data_files", "default", DatasetNotFoundError),
("hf-internal-testing/private_dataset_with_data_files", "default", DatasetNotFoundError),
("hf-internal-testing/gated_dataset_with_script", "default", DatasetNotFoundError),
("hf-internal-testing/private_dataset_with_script", "default", DatasetNotFoundError),
],
)
def test_get_dataset_config_info_error(path, config_name, expected_exception):
def test_get_dataset_config_info_raises(path, config_name, expected_exception):
kwargs = {"trust_remote_code": True} if path.endswith("_with_script") else {}
with pytest.raises(expected_exception):
get_dataset_config_info(path, config_name=config_name)
get_dataset_config_info(path, config_name=config_name, **kwargs)


@pytest.mark.parametrize(
Expand Down
Loading