Skip to content

Commit

Permalink
add test to check added response
Browse files Browse the repository at this point in the history
  • Loading branch information
Wauplin committed Aug 25, 2022
1 parent 3881774 commit 55a05a9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/huggingface_hub/utils/_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class RepositoryNotFoundError(HTTPError):
```py
>>> from huggingface_hub import model_info
>>> model_info("<non_existant_repository>")
>>> model_info("<non_existent_repository>")
huggingface_hub.utils._errors.RepositoryNotFoundError: 404 Client Error: Repository Not Found for url: <url>
```
"""
Expand All @@ -30,7 +30,7 @@ class RevisionNotFoundError(HTTPError):
```py
>>> from huggingface_hub import hf_hub_download
>>> hf_hub_download('bert-base-cased', 'config.json', revision='<non-existant-revision>')
>>> hf_hub_download('bert-base-cased', 'config.json', revision='<non-existent-revision>')
huggingface_hub.utils._errors.RevisionNotFoundError: 404 Client Error: Revision Not Found for url: <url>
```
"""
Expand All @@ -48,7 +48,7 @@ class EntryNotFoundError(HTTPError):
```py
>>> from huggingface_hub import hf_hub_download
>>> hf_hub_download('bert-base-cased', '<non-existant-file>')
>>> hf_hub_download('bert-base-cased', '<non-existent-file>')
huggingface_hub.utils._errors.EntryNotFoundError: 404 Client Error: Entry Not Found for url: <url>
```
"""
Expand Down
5 changes: 5 additions & 0 deletions tests/test_hf_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,11 @@ def test_create_commit_conflict(self):
parent_commit=parent_commit,
)
self.assertEqual(exc_ctx.exception.response.status_code, 412)
self.assertIn(
# Check the server message is added to the exception
"A commit has happened since. Please refresh and try again.",
str(exc_ctx.exception),
)
except Exception as err:
self.fail(err)
finally:
Expand Down

0 comments on commit 55a05a9

Please sign in to comment.