Skip to content

Commit 1e7b964

Browse files
committed
x
1 parent c9e0cbf commit 1e7b964

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

tests/test_llm_webkit.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@
44
from webmainbench.extractors.base import ExtractionResult
55

66

7+
def _is_llm_webkit_available():
8+
"""检查LLM-WebKit是否可用(用于预处理HTML模式)."""
9+
try:
10+
from webmainbench.extractors.factory import ExtractorFactory
11+
config = {"use_preprocessed_html": True}
12+
extractor = ExtractorFactory.create("llm-webkit", config)
13+
return True
14+
except Exception:
15+
return False
16+
17+
718
class TestLLMWebKitExtractor(unittest.TestCase):
819
"""LLM-WebKit extractor功能测试."""
920

@@ -147,6 +158,10 @@ def test_error_handling_in_preprocessed_mode(self, mock_extract_from_main):
147158
except Exception as e:
148159
self.skipTest(f"LLM-WebKit dependencies not available: {e}")
149160

161+
@unittest.skipUnless(
162+
_is_llm_webkit_available(),
163+
"跳过:需要LLM-WebKit依赖"
164+
)
150165
def test_preprocessed_html_integration(self):
151166
"""集成测试:演示预处理HTML功能的实际使用."""
152167
print("\n" + "="*50)
@@ -217,6 +232,10 @@ def test_preprocessed_html_integration(self):
217232
except Exception as e:
218233
self.skipTest(f"LLM-WebKit dependencies not available: {e}")
219234

235+
@unittest.skipIf(
236+
not _is_llm_webkit_available(),
237+
"LLM-WebKit dependencies not available"
238+
)
220239
def test_preprocessed_html_e2e(self):
221240
"""预处理HTML功能的端到端测试."""
222241
try:

0 commit comments

Comments
 (0)