Skip to content

Commit

Permalink
test match error msg
Browse files Browse the repository at this point in the history
  • Loading branch information
chengchingwen committed Jul 5, 2022
1 parent b51d569 commit 88f0b90
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,29 @@ const ENDPOINT_STAGING = "https://hub-ci.huggingface.co"
url_pinned_sha256 = HuggingFaceURL(DUMMY_MODEL_ID, HuggingFaceApi.PYTORCH_WEIGHTS_NAME)
@test get_etag(url_pinned_sha256) == DUMMY_MODEL_ID_PINNED_SHA256

@test_throws ErrorException("request status HTTP/2 404: EntryNotFound") cached_download(HuggingFaceURL(DUMMY_MODEL_ID, "missing.bin"))
missing_e = try
cached_download(HuggingFaceURL(DUMMY_MODEL_ID, "missing.bin"))
catch e
e
end
@test occursin("EntryNotFound", missing_e.msg)

url_invalid_revi = HuggingFaceURL(DUMMY_MODEL_ID, CONFIG_NAME;
revision = DUMMY_MODEL_ID_REVISION_INVALID)
@test_throws ErrorException("request status HTTP/2 404: RevisionNotFound") cached_download(url_invalid_revi)
invalid_e = try
cached_download(url_invalid_revi)
catch e
e
end
occursin("RevisionNotFound", invalid_e.msg)

url_invalid_repo = HuggingFaceURL("bert-base", "pytorch_model.bin")
@test_throws ErrorException("request status HTTP/2 401: RepoNotFound") cached_download(url_invalid_repo)
repo_e = try
cached_download(url_invalid_repo)
catch e
e
end
@test occursin("RepoNotFound", repo_e.msg)

url1 = HuggingFaceURL(DATASET_ID, DATASET_SAMPLE_PY_FILE;
repo_type="datasets", revision=DATASET_REVISION_ID_ONE_SPECIFIC_COMMIT)
Expand Down

2 comments on commit 88f0b90

@chengchingwen
Copy link
Member Author

Choose a reason for hiding this comment

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

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/63711

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.0.5 -m "<description of version>" 88f0b906f8bfae3045e89fdbb233b7e7fa46cc2d
git push origin v0.0.5

Please sign in to comment.