fix(rectification): unify discriminator question contract and rank by information gain
Python and TypeScript now share a four-option probe contract, persist Focus before asking, and pick the highest-value renderable probe instead of preferring low-gain career events over D24. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import unittest
|
||||
|
||||
from scripts.rectification.probe_question_contract import (
|
||||
ANSWER_CLASSES,
|
||||
EXISTENCE_STYLE_OPTIONS,
|
||||
QUALITY_STYLE_OPTIONS,
|
||||
complete_style_options,
|
||||
is_renderable_probe,
|
||||
)
|
||||
|
||||
|
||||
class ProbeQuestionContractTests(unittest.TestCase):
|
||||
def test_existence_completes_four_options(self) -> None:
|
||||
completed = complete_style_options("existence")
|
||||
self.assertEqual(completed, [dict(item) for item in EXISTENCE_STYLE_OPTIONS])
|
||||
|
||||
def test_quality_covers_unsure(self) -> None:
|
||||
completed = complete_style_options("event_quality")
|
||||
self.assertEqual(completed, [dict(item) for item in QUALITY_STYLE_OPTIONS])
|
||||
self.assertEqual({item["answer_class"] for item in completed or []}, set(ANSWER_CLASSES))
|
||||
|
||||
def test_varga_style_needs_two_scoring_labels(self) -> None:
|
||||
self.assertIsNone(complete_style_options("varga_style", [
|
||||
{"label": "巨蟹相处主动热情", "answer_class": "yes"},
|
||||
]))
|
||||
completed = complete_style_options("varga_style", [
|
||||
{"label": "巨蟹相处主动热情", "answer_class": "yes", "sign": "巨蟹"},
|
||||
{"label": "狮子独立强势", "answer_class": "weak_yes", "sign": "狮子"},
|
||||
])
|
||||
self.assertIsNotNone(completed)
|
||||
assert completed is not None
|
||||
self.assertEqual(len(completed), 4)
|
||||
self.assertEqual(next(item["label"] for item in completed if item["answer_class"] == "no"), "都不是这些特质")
|
||||
|
||||
def test_clock_copy_is_dropped_and_catalog_fills_existence(self) -> None:
|
||||
completed = complete_style_options("existence", [
|
||||
{"label": "08:12 左右发生", "answer_class": "yes"},
|
||||
])
|
||||
self.assertEqual(completed[0]["label"], "明确发生且时间吻合")
|
||||
|
||||
def test_unrenderable_varga_probe_is_rejected(self) -> None:
|
||||
self.assertFalse(is_renderable_probe({
|
||||
"information_gain": 1.2,
|
||||
"candidate_ids": ["05:00", "05:04"],
|
||||
"expected_outcomes": [{}, {}],
|
||||
"choice_kind": "varga_style",
|
||||
"style_options": [{"label": "外貌更接近第一种", "answer_class": "yes"}],
|
||||
}))
|
||||
@@ -270,6 +270,12 @@ class EventProbesTest(unittest.TestCase):
|
||||
self.assertGreaterEqual(len(row["expected_outcomes"]), 2)
|
||||
self.assertEqual(row["tracks"], ["vimshottari", "narayana"])
|
||||
self.assertFalse(row["unique_minute_claim"])
|
||||
self.assertEqual(len(row["style_options"]), 4)
|
||||
self.assertEqual(
|
||||
{item["answer_class"] for item in row["style_options"]},
|
||||
{"yes", "weak_yes", "no", "unsure"},
|
||||
)
|
||||
self.assertIn("这段记不清楚", {item["label"] for item in row["style_options"]})
|
||||
|
||||
def test_same_calendar_year_shift_is_not_a_boundary_year(self) -> None:
|
||||
built = {
|
||||
|
||||
Reference in New Issue
Block a user