v1: executing-plans 模式生成,54 文件 1320 行 Python
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
from __future__ import annotations
|
||||
from dataclasses import dataclass, field
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
|
||||
|
||||
@dataclass
|
||||
class FieldResult:
|
||||
field_name: str = ""
|
||||
status: str = "PASS"
|
||||
cobol_value: str = ""
|
||||
java_value: str = ""
|
||||
tolerance_applied: float = 0.0
|
||||
rounding_detected: str = ""
|
||||
suggestion: str = ""
|
||||
|
||||
|
||||
@dataclass
|
||||
class VerificationRun:
|
||||
program: str = ""
|
||||
timestamp: str = ""
|
||||
status: str = "PASS"
|
||||
exit_code: int = 0
|
||||
duration_s: float = 0.0
|
||||
fields_matched: int = 0
|
||||
fields_mismatched: int = 0
|
||||
coverage_target: str = "boundary"
|
||||
field_results: list[FieldResult] = field(default_factory=list)
|
||||
runner: str = "native"
|
||||
branch_rate: float = 0.0
|
||||
llm_cost: float = 0.0
|
||||
report_path: str = ""
|
||||
|
||||
def __post_init__(self):
|
||||
if not self.timestamp:
|
||||
self.timestamp = datetime.now().strftime("%Y%m%d-%H%M%S")
|
||||
|
||||
def verdict(self) -> str:
|
||||
return self.status
|
||||
|
||||
@property
|
||||
def total_fields(self) -> int:
|
||||
return self.fields_matched + self.fields_mismatched
|
||||
|
||||
|
||||
_fr = FieldResult(field_name="BR-AMT", status="MISMATCH")
|
||||
assert _fr.status == "MISMATCH"
|
||||
|
||||
_vr = VerificationRun(program="BILL-CALC", runner="spark")
|
||||
assert _vr.program == "BILL-CALC"
|
||||
assert _vr.runner == "spark"
|
||||
assert _vr.timestamp != ""
|
||||
Reference in New Issue
Block a user