Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s
27 lines
798 B
Python
27 lines
798 B
Python
"""
|
|
Test suite locking out TypeError in ContextCompressor._no_compression
|
|
when a search result dictionary contains 'content': None.
|
|
"""
|
|
|
|
import os
|
|
import sys
|
|
|
|
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
|
|
|
|
from compression_strategies import ContextCompressor
|
|
|
|
|
|
def test_no_compression_handles_null_content():
|
|
"""
|
|
Ensure _no_compression does not raise TypeError when result['content'] is None.
|
|
"""
|
|
compressor = ContextCompressor.__new__(ContextCompressor)
|
|
search_results = {
|
|
'results': [
|
|
{'title': 'Test', 'url': 'http://example.com', 'snippet': 'snippet', 'content': None}
|
|
]
|
|
}
|
|
compressed = compressor._no_compression(search_results)
|
|
assert compressed.original_length == 0
|
|
assert "Full Content:" in compressed.content
|