Skip to content

Commit 99dde9a

Browse files
committed
测试case
1 parent 9bc9a00 commit 99dde9a

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

tests/test_jmcomic/test_jm_api.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,24 @@ def run_func_async(func):
7676
print(e)
7777

7878
raise AssertionError(exception_list)
79+
80+
def test_partial_exception(self):
81+
class TestDownloader(JmDownloader):
82+
@catch_exception
83+
def download_by_image_detail(self, image: JmImageDetail):
84+
raise Exception('test_partial_exception')
85+
86+
@catch_exception
87+
def download_by_photo_detail(self, photo: JmPhotoDetail):
88+
if photo.index != 2:
89+
raise Exception('test_partial_exception')
90+
return super().download_by_photo_detail(photo)
91+
92+
self.assertRaises(
93+
PartialDownloadFailedException,
94+
lambda: download_album(182150, downloader=TestDownloader, check_exception=True)
95+
)
96+
self.assertRaises(
97+
PartialDownloadFailedException,
98+
lambda: download_photo(182151, downloader=TestDownloader, check_exception=True)
99+
)

0 commit comments

Comments
 (0)