Files
claude-config/bin/model_routing/test_review_choice.py
T

40 lines
2.0 KiB
Python

import unittest
import unittest.mock
from model_routing.review_choice import chosen, ReviewChoice
from model_routing import ladder
from model_routing.route import Route
from model_routing.ladder import Rung
HAIKU = Rung("claude-haiku-5-5", "low")
OPUS = Rung("claude-opus-5-5", "medium")
OPUS_HIGH = Rung("claude-opus-5-5", "high")
OPUS_XHIGH = Rung("claude-opus-5-5", "xhigh")
OPUS_MAX = Rung("claude-opus-5-5", "max")
FABLE = Rung("claude-fable-5-1", "max")
SONNET = Rung("claude-sonnet-5-5", "high")
class Chosen(unittest.TestCase):
def test_runs_the_reviewers_on_the_rung_the_items_e_plus_i_picks_and_seats_and_security_on_the_projects(self):
self.assertEqual(chosen(OPUS, Route(SONNET, 3, 2, 5)), ReviewChoice(OPUS_HIGH, {}, OPUS, OPUS, {OPUS_XHIGH: 6, OPUS_MAX: 7, FABLE: 8}))
def test_runs_the_reviewers_on_the_workers_rung_where_that_is_higher_and_no_e_plus_i_lifts_a_review(self):
self.assertEqual(chosen(OPUS, Route(OPUS_HIGH, 3, 4, 4)), ReviewChoice(OPUS_HIGH, {}, OPUS, OPUS, {OPUS_XHIGH: 6, OPUS_MAX: 7, FABLE: 8}))
def test_runs_the_reviewers_on_the_rung_an_e_plus_i_taken_in_picks_and_names_only_the_rungs_above_it(self):
self.assertEqual(chosen(OPUS, Route(OPUS, 3, 3, 5, escape_and_impact_taken_in=7)), ReviewChoice(OPUS_MAX, {}, OPUS, OPUS, {FABLE: 8}))
def test_names_the_lowest_e_plus_i_that_picks_each_higher_rung(self):
self.assertEqual(chosen(OPUS, Route(OPUS, 3, 3, 4)).higher, {OPUS_HIGH: 5, OPUS_XHIGH: 6, OPUS_MAX: 7, FABLE: 8})
def test_names_no_higher_rung_on_the_top_one(self):
self.assertEqual(chosen(OPUS, Route(FABLE, 3, 4, 5)).higher, {})
def test_puts_a_pass_a_replay_lowered_on_the_rung_the_replay_chose_while_no_e_plus_i_lifts_a_review(self):
with unittest.mock.patch.dict(ladder.REPLAYED, {("prose", "claude-opus-5-5"): HAIKU}):
lowered = chosen(OPUS, Route(SONNET, 3, 2, 4))
lifted = chosen(OPUS, Route(SONNET, 3, 2, 5))
self.assertEqual(lowered, ReviewChoice(OPUS, {"prose": HAIKU}, OPUS, OPUS, {OPUS_HIGH: 5, OPUS_XHIGH: 6, OPUS_MAX: 7, FABLE: 8}))
self.assertEqual(lifted.lowered, {})