Answer architecture round 3: 0 🔴, 1 🟡; give each left-out case its own test, and read the log from the default branch the checkout names
This commit is contained in:
@@ -123,8 +123,8 @@ def code_of(found: Round, effects: Effects) -> Code | Failure:
|
||||
if isinstance(default, Failure):
|
||||
return default
|
||||
default = default.strip().removeprefix("origin/")
|
||||
log = git(effects, found.root, "log", "--format=%H %at", "refs/remotes/origin/HEAD")
|
||||
main_line = git(effects, found.root, "log", "--first-parent", "--format=%H %at", "refs/remotes/origin/HEAD")
|
||||
log = git(effects, found.root, "log", "--format=%H %at", f"refs/remotes/origin/{default}")
|
||||
main_line = git(effects, found.root, "log", "--first-parent", "--format=%H %at", f"refs/remotes/origin/{default}")
|
||||
if isinstance(log, Failure):
|
||||
return log
|
||||
if isinstance(main_line, Failure):
|
||||
|
||||
@@ -211,13 +211,22 @@ class Main(unittest.TestCase):
|
||||
self.assertEqual(self.run_main(["claude-opus-5-5"], lambda rung: {"found": [0]})[0], 0)
|
||||
self.assertEqual(self.reviews[0][1:3], ("1\n", ""))
|
||||
|
||||
def test_leaves_out_a_round_whose_code_it_cannot_find(self):
|
||||
for gone in (lambda: self.set_prompt("Review the branch."), lambda: subprocess.run(["git", "remote", "set-head", "origin", "-d"], cwd=self.checkout, check=True), lambda: shutil.rmtree(self.checkout)):
|
||||
with self.subTest(gone):
|
||||
gone()
|
||||
code, _, err = self.run_main(["claude-opus-5-5"], unused)
|
||||
self.assertEqual(code, 1)
|
||||
self.assertIn("1 of 1 rounds holding a 🔴 or 🟡 are left out", err)
|
||||
def assert_left_out(self):
|
||||
code, _, err = self.run_main(["claude-opus-5-5"], unused)
|
||||
self.assertEqual(code, 1)
|
||||
self.assertIn("1 of 1 rounds holding a 🔴 or 🟡 are left out", err)
|
||||
|
||||
def test_leaves_out_a_round_whose_prompt_names_no_worktree(self):
|
||||
self.set_prompt("Review the branch.")
|
||||
self.assert_left_out()
|
||||
|
||||
def test_leaves_out_a_round_whose_checkout_names_no_default_branch(self):
|
||||
run_git(self.checkout, "remote", "set-head", "origin", "-d")
|
||||
self.assert_left_out()
|
||||
|
||||
def test_leaves_out_a_round_whose_checkout_is_gone(self):
|
||||
shutil.rmtree(self.checkout)
|
||||
self.assert_left_out()
|
||||
|
||||
def test_exits_1_on_a_usage_limit_bad_arguments_or_no_round_to_replay(self):
|
||||
code, _, err = self.run_main(["claude-opus-5-5"], lambda rung: {"type": "result", "api_error_status": 429, "result": "You've hit your limit"})
|
||||
|
||||
Reference in New Issue
Block a user