feat: add detect_all() for multi-variant detection
This commit is contained in:
@@ -50,3 +50,28 @@ def test_url_parsing_with_complex_paths():
|
||||
timeout=5,
|
||||
allow_redirects=True
|
||||
)
|
||||
|
||||
def test_detect_all_variants():
|
||||
"""Test detecting all llms.txt variants"""
|
||||
detector = LlmsTxtDetector("https://hono.dev/docs")
|
||||
|
||||
with patch('cli.llms_txt_detector.requests.head') as mock_head:
|
||||
# Mock responses for different variants
|
||||
def mock_response(url, **kwargs):
|
||||
response = Mock()
|
||||
# All 3 variants exist for Hono
|
||||
if 'llms-full.txt' in url or 'llms.txt' in url or 'llms-small.txt' in url:
|
||||
response.status_code = 200
|
||||
else:
|
||||
response.status_code = 404
|
||||
return response
|
||||
|
||||
mock_head.side_effect = mock_response
|
||||
|
||||
variants = detector.detect_all()
|
||||
|
||||
assert len(variants) == 3
|
||||
assert any(v['variant'] == 'full' for v in variants)
|
||||
assert any(v['variant'] == 'standard' for v in variants)
|
||||
assert any(v['variant'] == 'small' for v in variants)
|
||||
assert all('url' in v for v in variants)
|
||||
|
||||
Reference in New Issue
Block a user