Files
GTI_GERENCIADOR_FISCAL/fiscal/central/tests/test_autonomous_operation_simulation.py
gti d21a9d1140 Add 'fiscal/' from commit '102ba84500dbd9655a0471288c3e278652593ca9'
git-subtree-dir: fiscal
git-subtree-mainline: d95165fc8f
git-subtree-split: 102ba84500
2026-09-29 14:43:23 -03:00

19 lines
807 B
Python

from central.app.operational_state import classify_product_state, summarize_operational_states
def test_twenty_thousand_products_keep_agent_healthy_with_safe_blocks():
states = [{"state": "COMPLETE"}] * 19900 + [{"state": "BLOCKED_MISSING_EVIDENCE"}] * 100
summary = summarize_operational_states(states)
assert summary["AUTONOMOUSLY_PROCESSABLE_PRODUCTS"] == 20000
assert summary["SAFE_BLOCKED"] == 100
assert summary["AGENT_HEALTH"] == "HEALTHY"
def test_new_evidence_changes_product_state_without_global_failure():
blocked = classify_product_state({"CODIGO": "P1"}, {"status": "INVALID_NCM"})
resolved = classify_product_state({"CODIGO": "P1"}, {"status": "EXACT_NCM"})
assert blocked["state"] == "BLOCKED_MISSING_EVIDENCE"
assert resolved["state"] == "COMPLETE"