ModelTranslator: uv_gate_ok/pick_best_candidate 加 overlap_tol 参数
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
2673cda83a
commit
b02877a2cf
@@ -91,6 +91,18 @@ class TestUvGateOk(unittest.TestCase):
|
||||
def test_overlap_none_treated_as_zero(self):
|
||||
self.assertTrue(bd.uv_gate_ok(0.01, None))
|
||||
|
||||
def test_custom_overlap_tol_allows_higher_overlap(self):
|
||||
self.assertTrue(bd.uv_gate_ok(0.0, 0.12, overlap_tol=0.15))
|
||||
self.assertFalse(bd.uv_gate_ok(0.0, 0.16, overlap_tol=0.15))
|
||||
|
||||
def test_custom_overlap_tol_does_not_relax_flip(self):
|
||||
# 放宽重叠不影响翻转判定(翻转仍按 UV_FLIP_TOL)
|
||||
self.assertFalse(bd.uv_gate_ok(0.03, 0.0, overlap_tol=0.5))
|
||||
|
||||
def test_default_overlap_tol_matches_constant(self):
|
||||
self.assertTrue(bd.uv_gate_ok(0.0, bd.UV_OVERLAP_TOL))
|
||||
self.assertFalse(bd.uv_gate_ok(0.0, bd.UV_OVERLAP_TOL + 0.01))
|
||||
|
||||
|
||||
class TestUvpmModeLabel(unittest.TestCase):
|
||||
def test_applied_appends_suffix(self):
|
||||
@@ -131,6 +143,13 @@ class TestPickBestCandidate(unittest.TestCase):
|
||||
best = bd.pick_best_candidate(cands)
|
||||
self.assertEqual(best["islands"], 42)
|
||||
|
||||
def test_overlap_tol_lets_more_candidates_pass(self):
|
||||
# overlap=0.12 在默认 8% 门限下不过;放宽到 0.15 后过门并被选中
|
||||
cands = [self._c(0.0, 0.12, 50, 55)]
|
||||
self.assertIsNone(bd.pick_best_candidate(cands))
|
||||
best = bd.pick_best_candidate(cands, overlap_tol=0.15)
|
||||
self.assertEqual(best["angle"], 55)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user