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
24 lines
767 B
Python
24 lines
767 B
Python
"""
|
|
Test suite locking out ZeroDivisionError in benchmark summary print logic
|
|
when time_basic is 0.0 or df_sample is empty.
|
|
"""
|
|
|
|
def test_benchmark_pct_reduction_zero_division():
|
|
"""
|
|
Ensure zero time_basic does not raise ZeroDivisionError during benchmark calculation.
|
|
"""
|
|
time_basic = 0.0
|
|
time_optimized = 0.0
|
|
pct_reduction = (1 - time_optimized / time_basic) * 100 if time_basic > 0 else 0.0
|
|
assert pct_reduction == 0.0
|
|
|
|
|
|
def test_benchmark_extrapolation_zero_sample():
|
|
"""
|
|
Ensure empty df_sample does not raise ZeroDivisionError during extrapolation check.
|
|
"""
|
|
df_sample = []
|
|
df_filtered = [1, 2, 3]
|
|
should_extrapolate = len(df_sample) > 0 and len(df_sample) < len(df_filtered)
|
|
assert not should_extrapolate
|