test(todo): make JSON-string coercion test order-agnostic

The type-coercion test pinned index order of todos, which #42649's
_normalize_order intentionally changes (in_progress lifts ahead of
earlier pending rows). Assert coercion by id instead of position.
This commit is contained in:
Teknium
2026-08-14 19:08:39 -07:00
parent 99033ab1f0
commit f8cc6d082e
+6 -2
View File
@@ -23,8 +23,12 @@ class TestJsonStringCoercion:
result = json.loads(todo_tool(todos=todos_str, store=store))
assert "error" not in result
assert result["summary"]["total"] == 2
assert result["todos"][0]["id"] == "t1"
assert result["todos"][1]["status"] == "in_progress"
# Order-agnostic: TodoStore._normalize_order may lift the in_progress
# item ahead of earlier pending rows (#42649); this test only pins
# JSON-string coercion, not ordering.
by_id = {t["id"]: t for t in result["todos"]}
assert set(by_id) == {"t1", "t2"}
assert by_id["t2"]["status"] == "in_progress"
def test_non_list_non_string_returns_error(self):