v1: executing-plans 模式生成,54 文件 1320 行 Python
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import sys, os
|
||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..")))
|
||||
from comparator.rounding_detect import detect_rounding, RoundingResult
|
||||
|
||||
|
||||
def test_truncation_detected():
|
||||
r = detect_rounding("1500000", "1499999")
|
||||
assert r.mode in ("TRUNCATE", "HALF_UP")
|
||||
|
||||
|
||||
def test_exact_match():
|
||||
r = detect_rounding("1500000", "1500000")
|
||||
assert r.mode == "EXACT"
|
||||
assert r.confidence == 1.0
|
||||
|
||||
|
||||
def test_low_confidence_small_diff():
|
||||
r = detect_rounding("1500", "1498")
|
||||
assert r.confidence < 1.0
|
||||
|
||||
|
||||
def test_suggestion_generated():
|
||||
r = detect_rounding("1500000", "1499999")
|
||||
assert len(r.suggestion) > 0
|
||||
Reference in New Issue
Block a user