Download tests/test_classification.py from LeonardoMdSA/Context-aware-NLP-classification-platform-with-MCP: direct link, hf CLI and curl.
- Browser
- Download file 908 Bytes
-
https://huggingface.co/spaces/LeonardoMdSA/Context-aware-NLP-classification-platform-with-MCP/resolve/main/tests/test_classification.py
- Command line
-
hf download hf://spaces/LeonardoMdSA/Context-aware-NLP-classification-platform-with-MCP/tests/test_classification.py
-
curl -L -o test_classification.py https://huggingface.co/spaces/LeonardoMdSA/Context-aware-NLP-classification-platform-with-MCP/resolve/main/tests/test_classification.py
908 Bytes
| from app.classification.decision import classify_document | |
| from app.orchestration.context_resolver import resolve_context | |
| def test_invoice_classification(embedded_mcp_servers): | |
| # Ensure MCP context is loaded | |
| context = resolve_context( | |
| text="Invoice for Q4 2025 total amount $4,500", | |
| metadata={"department": "finance"} | |
| ) | |
| result = classify_document( | |
| text="Invoice for Q4 2025 total amount $4,500", | |
| context=context | |
| ) | |
| assert result.label == "finance.invoice" | |
| assert result.confidence > 0.5 | |
| assert result.abstained is False | |
| def test_abstention_logic(embedded_mcp_servers): | |
| context = resolve_context( | |
| text="Random unrelated text with no meaning", | |
| metadata={} | |
| ) | |
| result = classify_document( | |
| text="Random unrelated text with no meaning", | |
| context=context | |
| ) | |
| assert "confidence" in result.__dict__ | |