From 4b5aa45379fa3f916ff34396ea5abdac015d4d12 Mon Sep 17 00:00:00 2001 From: Will Miao Date: Mon, 6 Jul 2026 01:02:04 +0800 Subject: [PATCH] chore(tests): update bash code block tests to match preserved-bash behavior MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit 9a0d866b changed _strip_fenced_code_blocks to preserve bash/shell code blocks (they carry CLI setup and trigger-word metadata signal). Update the two affected tests to expect bash content in the output instead of asserting it is stripped. - Rename test_bash_code_block_stripped → test_bash_code_block_preserved - Update assertions: expect 'pip install' in result --- tests/metadata_ops/test_metadata_ops.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/metadata_ops/test_metadata_ops.py b/tests/metadata_ops/test_metadata_ops.py index ec93454d..45131103 100644 --- a/tests/metadata_ops/test_metadata_ops.py +++ b/tests/metadata_ops/test_metadata_ops.py @@ -749,7 +749,9 @@ Some text. assert "## Usage" in result assert "## Description" in result - def test_bash_code_block_stripped(self): + def test_bash_code_block_preserved(self): + """Bash code blocks are preserved — they contain CLI setup commands + and trigger-word install instructions that carry metadata signal.""" md = """## Setup ```bash pip install diffusers @@ -757,13 +759,16 @@ huggingface-cli download repo ``` """ result = self._clean(md) - assert "pip install" not in result + assert "pip install" in result + assert "huggingface-cli download repo" in result assert "## Setup" in result def test_code_block_sections_remain_separated(self): + """Bash code blocks are preserved (they carry metadata signal), + and surrounding section headings survive.""" md = "## Install\n```bash\npip install x\n```\n\n## Usage\nSome text." result = self._clean(md) - assert "pip install" not in result + assert "pip install x" in result assert "## Install" in result assert "## Usage" in result assert "Some text." in result