You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit edfa117
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: .claude/archive/AGENT_PROMPT_WRITE_TESTS.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ Tests for the `flm.main` module and its submodules go in `test/main/`. All other
10
10
11
11
**flm-core** is a Python library implementing *Flexible Latex-like Markup* (FLM): an approximate subset of LaTeX syntax parsed via `pylatexenc` (v3 pre-release) and rendered to multiple output formats (HTML, LaTeX, plain text, Markdown). The codebase is also transpiled to JavaScript via Transcrypt, which constrains Python idioms.
12
12
13
-
Packages are managed via `poetry`. Run tests with `poetry run python -m pytest test/ -v`.
13
+
Packages are managed via `uv`. Run tests with `uv run python -m pytest test/ -v`.
14
14
15
15
## Critical Rules
16
16
@@ -36,7 +36,7 @@ If you need an "in" check, write `self.assertTrue(x in items)`.
36
36
### Test Quality Requirements
37
37
38
38
1.**Exact output matching**: Use `self.assertEqual(result, expected)` with the full expected output. Do NOT use `self.assertTrue(substring in result)` for testing rendered output.
39
-
2.**To get exact outputs**: render the FLM input first by running the code, capture the actual output, then verify it is correct, then use that as the assertEqual expectation. You can run snippets via `poetry run python -c "..."` to see actual outputs before writing assertions.
39
+
2.**To get exact outputs**: render the FLM input first by running the code, capture the actual output, then verify it is correct, then use that as the assertEqual expectation. You can run snippets via `uv run python -c "..."` to see actual outputs before writing assertions.
40
40
3.**Test file naming**: `test/test_<module>.py` for core and feature modules, `test/main/test_main_<submodule>.py` for main submodules.
41
41
4.**One test class per logical group** (e.g. `TestFeatureQuoteRendering`, `TestFeatureQuoteInit`, `TestFeatureQuoteRecomposer`).
42
42
5.**Set `maxDiff = None`** on test classes that compare rendered output.
@@ -166,7 +166,7 @@ Skip these main submodules (they involve filesystem/process operations not suita
166
166
3.**Decide**: if existing tests are already high quality with exact assertions and good coverage, skip to the next module. If they need improvement, **keep the existing tests** and add any additional test cases you deem necessary. If existing tests are incomplete, add more tests to test other inputs or edge cases that were missed.
167
167
4.**Capture actual outputs** by running the code first:
168
168
```bash
169
-
poetry run python -c "
169
+
uv run python -c "
170
170
from flm.flmenvironment import make_standard_environment
171
171
from flm.stdfeatures import standard_features
172
172
from flm.fragmentrenderer.html import HtmlFragmentRenderer
@@ -177,11 +177,11 @@ Skip these main submodules (they involve filesystem/process operations not suita
177
177
```
178
178
5.**CHECK THE OUTPUTS**: Make sure that the outputs are indeed expected for the test code you designed. Flag any suspicious behavior or suspected bug with a comment `# REVIEW: <note>` in the source code. Only fix the source code itself if the error is a typo or a missing import. In all other cases, keep the failing test and mark it to be skipped pending code review.
179
179
6.**Write the test file** with exact assertEqual assertions using the captured outputs, for test cases whose outputs match the expected output.
180
-
7.**Run the tests** for that module: `poetry run python -m pytest test/test_<module>.py -v`
180
+
7.**Run the tests** for that module: `uv run python -m pytest test/test_<module>.py -v`
181
181
8.**Fix any failures** — if the expected output doesn't match, re-capture and correct. Flag suspicious behavior (see point 5.) instead of adapting the test itself to the suspicious behavior.
182
-
9.**Run the full test suite** periodically: `poetry run python -m pytest test/ -v` to check for regressions.
182
+
9.**Run the full test suite** periodically: `uv run python -m pytest test/ -v` to check for regressions.
183
183
10.**When you're finished with the module** — read the module again and identify classes, functions, methods, or attributes that are not sufficiently well tested according to the standards specified here. If you find any, complete the tests.
184
-
11.**Check also the JS-transpiled tests** — by running `(cd flm-js && poetry run python ./generate_flm_js.py --pylatexenc-src-dir=../../pylatexenc --delete-target-dir --compile-tests && node test-flm-js/runtests.js)`. If tests fail, identify the failure location and identify its cause. Do not change the test logic. Remove the test only if it is clearly unnecessary. Ask for the user's input if fixing the test involves anything else than minor refactoring to remove a feature not supported by transcrypt. JS output and Python output must be the same (except for string-formatted floating-point numbers).
184
+
11.**Check also the JS-transpiled tests** — by running `(cd flm-js && uv run --group buildjslib python ./generate_flm_js.py --pylatexenc-src-dir=../../pylatexenc --delete-target-dir --compile-tests && node test-flm-js/runtests.js)`. If tests fail, identify the failure location and identify its cause. Do not change the test logic. Remove the test only if it is clearly unnecessary. Ask for the user's input if fixing the test involves anything else than minor refactoring to remove a feature not supported by transcrypt. JS output and Python output must be the same (except for string-formatted floating-point numbers).
Copy file name to clipboardExpand all lines: CLAUDE.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@
6
6
7
7
The codebase is also transpiled to JavaScript via **Transcrypt** (`flm-js/`). This constrains what Python idioms are usable.
8
8
9
-
Packages are managed via `poetry`. Prefix test and python-specific calls appropriately, e.g. `poetry run python -m pytest ...`
9
+
Packages are managed via `uv`. Prefix test and python-specific calls appropriately, e.g. `uv run python -m pytest ...`
10
10
11
11
## Structure
12
12
@@ -120,4 +120,4 @@ Used for forward references (`\ref`, `\eqref`, `\cite`). The mechanism:
120
120
121
121
## Documentation
122
122
123
-
Sphinx docs live in `doc/`. Build with `poetry run sphinx-build -b html doc doc/_build/html`. API docs use `autodoc` directives pulling from source docstrings. User guide pages (overview, standard-syntax, configuration, features, model, lib) are hand-written RST. The build generates `flm-config-json-schema.json` in the HTML output root via a `build-finished` hook in `conf.py`. CLI flags `--validate-config-only` and `--print-config-json-schema` expose schema validation and generation.
123
+
Sphinx docs live in `doc/`. Build with `uv run --group builddoc sphinx-build -b html doc doc/_build/html`. API docs use `autodoc` directives pulling from source docstrings. User guide pages (overview, standard-syntax, configuration, features, model, lib) are hand-written RST. The build generates `flm-config-json-schema.json` in the HTML output root via a `build-finished` hook in `conf.py`. CLI flags `--validate-config-only` and `--print-config-json-schema` expose schema validation and generation.
0 commit comments