File size: 1,516 Bytes
b25b8f2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | """
Unit tests for Error Classification
"""
import pytest
from utils.error_classifier import classify_error
def test_arithmetic_error_classification():
"""Test arithmetic error classification"""
error = {
"type": "calculation_error",
"found": "5 - 1 = 6",
"correct": "5 - 1 = 4",
"operation": "-",
"step_number": 1
}
classified = classify_error(error)
assert classified["category"] == "Arithmetic Error"
assert classified["severity"] == "HIGH"
assert classified["fixable"] == True
assert classified["fixability_score"] > 0.90
def test_logical_error_classification():
"""Test logical error classification"""
error = {
"type": "logical_error",
"description": "Contradiction detected",
"step_number": 1
}
classified = classify_error(error)
assert classified["category"] == "Logical Error"
assert classified["severity"] == "MEDIUM"
assert classified["fixability_score"] == 0.60
def test_operation_mismatch_classification():
"""Test operation mismatch classification"""
error = {
"type": "operation_mismatch",
"description": "Text mentions subtract but math uses +",
"step_number": 1
}
classified = classify_error(error)
assert classified["category"] == "Operation Mismatch"
assert classified["severity"] == "HIGH"
assert classified["fixable"] == True
|