Skip to content

Commit

Permalink
Test get_dataset_config_info with non-existing/gated/private dataset (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
albertvillanova authored Aug 26, 2024
1 parent e4c87a6 commit be5cff0
Showing 1 changed file with 10 additions and 2 deletions.
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

0 comments on commit be5cff0

Please sign in to comment.