commit remaining modified project files
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
"""Tests for vlm.review_display helpers."""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from vlm.review_display import (
|
||||
build_csv_rows,
|
||||
format_paths_for_detail,
|
||||
review_row_status_symbol,
|
||||
risk_flags_to_labels,
|
||||
)
|
||||
|
||||
|
||||
def test_risk_flags_to_labels():
|
||||
assert "需人工判断" in risk_flags_to_labels("manual_review")
|
||||
assert "目标冲突" in risk_flags_to_labels("conflict")
|
||||
assert risk_flags_to_labels("") == ""
|
||||
assert risk_flags_to_labels("unknown_flag") == "unknown_flag"
|
||||
|
||||
|
||||
def test_format_paths_for_detail_relative():
|
||||
root = Path("/media/lib")
|
||||
text = format_paths_for_detail(
|
||||
str(root / "a" / "f.mkv"),
|
||||
str(root / "b" / "f.mkv"),
|
||||
root,
|
||||
)
|
||||
assert "来源:" in text
|
||||
assert "f.mkv" in text
|
||||
assert "目标:" in text
|
||||
|
||||
|
||||
def test_build_csv_rows_merges_operation_type():
|
||||
rows = [
|
||||
{
|
||||
"index": "1",
|
||||
"operation_type": "move",
|
||||
"risk_flags": "manual_review",
|
||||
"source_path": "/x",
|
||||
"destination_path": "/y",
|
||||
"reason": "r",
|
||||
}
|
||||
]
|
||||
merged = build_csv_rows(rows, {1: "no-op"})
|
||||
assert merged[0]["operation_type"] == "no-op"
|
||||
assert merged[0]["risk_flags"] == "manual_review"
|
||||
|
||||
|
||||
def test_review_row_status_symbol():
|
||||
initial = {1: "move"}
|
||||
current = {1: "move"}
|
||||
assert review_row_status_symbol(current, initial, 1) == "·"
|
||||
current2 = {1: "no-op"}
|
||||
assert review_row_status_symbol(current2, initial, 1) == "✗"
|
||||
current3 = {1: "move"}
|
||||
initial3 = {1: "no-op"}
|
||||
assert review_row_status_symbol(current3, initial3, 1) == "✓"
|
||||
Reference in New Issue
Block a user