mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-11-14 18:24:37 -06:00
The toolchain folder is now binder/, and the root ./binder symlink is gone. The command is ./binder/binder: a plain path to the script, with no link and no install step. Every invocation moved with it: pre-commit entries, workflow steps, the VS Code extension's command palette, help text, and docs. - bindery/ paths and bindery.* imports, including the chapter code cells that import binder.tools.figures, now name binder/. - Binder (mybinder.org) reads its configuration from a root binder/ folder and refuses to build when binder/ and .binder/ both exist. .binder/postBuild and .binder/requirements.txt move into binder/, so the TinyTorch "Launch Binder" buttons keep working; binder/README.md records which file names the toolchain must not use there. - contributors/projects.json still pointed the book's contributor record at publishing/; it now names binder/, where that .all-contributorsrc lives. - The margin-figure reader-link audit report linked its 222 figures through the retired quarto/ tree; the links now resolve under books/. The hooks reformatted hidden Python cells and trimmed whitespace in the Volume II chapters whose figure imports this rename touches. Checks: ./binder/binder check cli passes (contract and canonical hooks), binder.tools.figures imports, and every workflow YAML file parses. binder test suite, excluding the four modules that cannot import mlsysim through the root symlink (fixed separately): 7 failed, 346 passed. The GitHub repository variables BOOK_ROOT, BOOK_TOOLS, BOOK_DEPS, and BOOK_DOCKER still name the retired book/ layout and must change when this reaches origin.
72 lines
1.8 KiB
Python
72 lines
1.8 KiB
Python
from types import SimpleNamespace
|
|
|
|
from binder.cli.commands.validate import ValidateCommand
|
|
|
|
|
|
def _command(tmp_path):
|
|
return ValidateCommand(
|
|
config_manager=SimpleNamespace(book_dir=tmp_path),
|
|
chapter_discovery=None,
|
|
)
|
|
|
|
|
|
def test_pipe_table_caption_below_table_passes(tmp_path):
|
|
qmd = tmp_path / "chapter.qmd"
|
|
qmd.write_text(
|
|
"""| **Dimension** | **What it measures** |
|
|
|:--------------|:---------------------|
|
|
| Throughput | Tokens per second |
|
|
|
|
: **Efficiency Frontier Dimensions**: Performance trade-offs. {#tbl-frontier}
|
|
""",
|
|
encoding="utf-8",
|
|
)
|
|
|
|
result = _command(tmp_path)._run_table_caption_position(qmd)
|
|
|
|
assert result.issues == []
|
|
|
|
|
|
def test_pipe_table_caption_above_table_fails(tmp_path):
|
|
qmd = tmp_path / "chapter.qmd"
|
|
qmd.write_text(
|
|
""": **Efficiency Frontier Dimensions**: Performance trade-offs. {#tbl-frontier}
|
|
|
|
| **Dimension** | **What it measures** |
|
|
|:--------------|:---------------------|
|
|
| Throughput | Tokens per second |
|
|
""",
|
|
encoding="utf-8",
|
|
)
|
|
|
|
result = _command(tmp_path)._run_table_caption_position(qmd)
|
|
|
|
assert len(result.issues) == 1
|
|
issue = result.issues[0]
|
|
assert issue.code == "table_caption_before_pipe_table"
|
|
assert issue.line == 1
|
|
assert "table header starts at line 3" in issue.message
|
|
|
|
|
|
def test_caption_between_two_tables_is_not_treated_as_top_caption(tmp_path):
|
|
qmd = tmp_path / "chapter.qmd"
|
|
qmd.write_text(
|
|
"""| A | B |
|
|
|---|---|
|
|
| 1 | 2 |
|
|
|
|
: **First Table**: Caption for the first table. {#tbl-first}
|
|
|
|
| C | D |
|
|
|---|---|
|
|
| 3 | 4 |
|
|
|
|
: **Second Table**: Caption for the second table. {#tbl-second}
|
|
""",
|
|
encoding="utf-8",
|
|
)
|
|
|
|
result = _command(tmp_path)._run_table_caption_position(qmd)
|
|
|
|
assert result.issues == []
|