testing.update_test_outcomes
Update the expected outcome of failing unit tests
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-02
- Stars
- ★ 0
- Forks
- 1
01 前言 Front Matter
- model
- haiku
- description
- Update the expected outcome of failing unit tests
03 SKILL.md 正文
Goal
- The user passes you a list of tests or a repro script with tests failing
<FAILING_TESTS>because of mismatching actual vs expected outputs
Important
- For all code you must follow the instructions in
.claude/skills/coding.rules.md - Follow the invariants and conventions for unit tests in
.claude/skills/testing.rules.md
Workflow
Run the Failing Tests
- Run the tests one at the time in the way the user suggested to verify that the tests are failing due to mismatching outputs
Classify the Assertion Method
-
Check each failing test method and find out if the result is checked with
self.check_string()self.assert_equal()or similar assertion (e.g.,hunteuti.assert_sys_calls(),self.assertEqual())
-
Print a table with the following info: path of test | fail / pass | check_string or assert_equal
| Path | Test | Status | Assertion Method | |------|------|--------|------------------| | dev_scripts_helpers/documentation/test/test_notes_to_pdf.py | Test_notes_to_pdf_latex_options::test1 | FAIL | self.assert_equal() with fuzzy_match=True | | dev_scripts_helpers/documentation/test/test_notes_to_pdf.py | Test_notes_to_pdf_latex_options::test2 | FAIL | self.assert_equal() with fuzzy_match=True | | dev_scripts_helpers/documentation/test/test_notes_to_pdf.py | Test_notes_to_pdf_output_types::test1 | FAIL | self.assert_equal() with fuzzy_match=True | -
Save this to a file
tmp.update_test_outcomes.failing_tests.md
Update the Expected Output
-
For each failing test method:
- If the result is checked with
self.check_string()- Run the test adding the pytest option
--update_goldento refresh the output
- Run the test adding the pytest option
- If the result is checked with
self.assert_equal()or similar assertions (e.g.,hunteuti.assert_sys_calls()) read the file<TEST_DIR>/tmp.initial.actual.txt(e.g.,dev_scripts_helpers/documentation/test/outcomes/Test_run_pandoc_to_html.test1) containing the actual variable and update theexpectedvariable- E.g.,
expected = """ [{'args': (f'jupytext --to ipynb --update {py_file}',), 'function': 'hsystem.system', 'kwargs': {}}, {'args': (f'jupytext --sync {py_file}',), 'function': 'hsystem.system', 'kwargs': {}}] """
- E.g.,
- If the result is checked with
-
Follow the directions in
.claude/skills/testing.rules.md## Code Formatting in Tests# Test Input and Output Handling
-
Do not change way of checking results
- E.g., do not replace
self.assert*()withself.check_string()and vice versa - E.g., do not replace
self.assert*()withself.assertIn()
- E.g., do not replace
Verification
- [ ] Run all the tests to make sure they are passing
04 同仓库更多 Skills
tutorial_in_60_mins.propagate_docker_changes
Sync tutorial and class-project Docker files to match project_template
tutorial_in_60_mins.merge_markdown
Merge the content of a markdown file into a Jupyter notebook
tutorial_in_60_mins.format
Format a directory to follow the "Learn X in 60 Minutes" tutorial conventions
tutorial_in_60_mins.create
Create a tutorial directory for the Learn X in 60 Minutes conventions
todo.reorg_in_progress
Reorganize ai_task_queue.md so in-progress tasks, not-started tasks, and mislabeled topic headers sit under the right H1 stage
todo.reorg_headers
Reorganize ai_task_queue.md .md so every H2 topic matches ALL TOPICS and every H3 task sits under the right topic, keeping its H1 stage