@@ -110,6 +110,11 @@ def invoke(self, option, **kwargs):
110110 jmcomic .download_photo (photo_id , self .option , extra = counter_feature )
111111 self .assertEqual (custom_feature_call_count , 3 )
112112
113+ # 测试 download_batch (Iterable 批量输入): 确保 extra 参数不被丢弃
114+ jmcomic .download_batch (jmcomic .download_album , [album_id ], self .option , extra = counter_feature )
115+ # 上面增加了 1 个 album (包含 1 个 photo),因此 invoke 追加 2 次,总计 5 次
116+ self .assertEqual (custom_feature_call_count , 5 )
117+
113118 def test_export_features (self ):
114119 album_id = '438516'
115120
@@ -156,3 +161,18 @@ def test_export_features_photo(self):
156161 import os
157162 pdf_path = os .path .join (export_dir , pdf_name )
158163 self .assertTrue (os .path .exists (pdf_path ), f"未生成精确匹配的 PDF 文件 (章节级): { pdf_path } " )
164+
165+ def test_export_album_use_photo_rule (self ):
166+ """
167+ 负面测试:在 Album 模式下强行使用 Photo 级规则(Ptitle),预期报错。
168+ 本子=album,本子的章节=photo。下载本子时,photo对象为None。
169+ """
170+ album_id = '438516'
171+ # 强行使用 Ptitle
172+ f = Feature .export_pdf (filename_rule = 'Ptitle' )
173+
174+ # 验证底层 invoke 会抛出 AttributeError
175+ # 因为在 download_album 的 after_album 阶段,photo 为 None
176+ with self .assertRaises (AttributeError ):
177+ album = self .client .get_album_detail (album_id )
178+ f .invoke (self .option , feature_from = 'download_album' , when = 'after_album' , album = album , photo = None )
0 commit comments