-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: make number of retries configurable (#1)
- Loading branch information
1 parent
7949d79
commit 66d32d9
Showing
7 changed files
with
107 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import pytest | ||
from pyanilist import ( | ||
AsyncAnilist, | ||
HTTPStatusError, | ||
MediaType, | ||
ValidationError, | ||
) | ||
|
||
anilist = AsyncAnilist(retries=1) | ||
|
||
|
||
async def test_anilist_title_doesnt_exist() -> None: | ||
with pytest.raises(HTTPStatusError, match="Not Found."): | ||
await anilist.search("Title does not exist", type=MediaType.MANGA) | ||
|
||
|
||
async def test_anilist_bad_search_combo() -> None: | ||
with pytest.raises(HTTPStatusError, match="Not Found."): | ||
await anilist.search("Attack on titan", season_year=1999) | ||
|
||
|
||
async def test_anilist_wrong_input_types() -> None: | ||
with pytest.raises(ValidationError): | ||
await anilist.search(123456789, season_year="hello", type=True) # type: ignore | ||
|
||
|
||
async def test_anilist_bad_id() -> None: | ||
with pytest.raises(HTTPStatusError, match="400 Bad Request"): | ||
await anilist.get(9999999999) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import pytest | ||
from pyanilist import ( | ||
Anilist, | ||
HTTPStatusError, | ||
MediaType, | ||
ValidationError, | ||
) | ||
|
||
anilist = Anilist(retries=1) | ||
|
||
|
||
def test_anilist_title_doesnt_exist() -> None: | ||
with pytest.raises(HTTPStatusError, match="Not Found."): | ||
anilist.search("Title does not exist", type=MediaType.MANGA) | ||
|
||
|
||
def test_anilist_bad_search_combo() -> None: | ||
with pytest.raises(HTTPStatusError, match="Not Found."): | ||
anilist.search("Attack on titan", season_year=1999) | ||
|
||
|
||
def test_anilist_wrong_input_types() -> None: | ||
with pytest.raises(ValidationError): | ||
anilist.search(123456789, season_year="hello", type=True) # type: ignore | ||
|
||
|
||
def test_anilist_bad_id() -> None: | ||
with pytest.raises(HTTPStatusError, match="400 Bad Request"): | ||
anilist.get(9999999999) |