fix(datasets): improve get_safe_version raise (#4263)

* fix: Pass the required response argument to RevisionNotFoundError

* chore(dataset): get_safe_version raise

---------

Co-authored-by: Harshal Janjani <harshaljanjani@gmail.com>
This commit is contained in:
Steven Palma
2026-07-31 14:13:14 +02:00
committed by GitHub
parent 8e2a077f09
commit 0a4510c74e
2 changed files with 30 additions and 13 deletions
+17
View File
@@ -180,3 +180,20 @@ def test_non_dict_passthrough_last_wins():
out = combine_feature_dicts(g1, g2)
# For non-dict entries the last one wins
assert out["misc"] == 456
def test_get_safe_version_raises_on_repo_without_version_tags(monkeypatch):
monkeypatch.setattr(dataset_utils, "get_repo_versions", Mock(return_value=[]))
with pytest.raises(RuntimeError, match="must be tagged with a codebase version"):
get_safe_version("private/repo", "v3.0")
def test_get_safe_version_error_reports_repo_id(monkeypatch):
repo_id = "private/repo"
monkeypatch.setattr(dataset_utils, "get_repo_versions", Mock(return_value=[]))
with pytest.raises(RuntimeError) as exc_info:
get_safe_version(repo_id, "v3.0")
assert repo_id in str(exc_info.value)