fix: 破损 HTML 表格扫描失败关闭
This commit is contained in:
@@ -23,6 +23,7 @@ def test_unescapes_one_layer_only_in_strict_cell_text() -> None:
|
||||
"\noutside <"
|
||||
)
|
||||
assert len(result.changes) == 3
|
||||
assert result.modifiers[0].version == "1.0.1"
|
||||
|
||||
|
||||
def test_multiple_tables_and_cells_report_source_order() -> None:
|
||||
@@ -47,6 +48,21 @@ def test_non_strict_or_outside_content_is_preserved(markdown: str) -> None:
|
||||
assert transform(markdown).output_markdown == markdown
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"markdown",
|
||||
[
|
||||
"<table>broken<table><tr><td>&lt;</td></tr></table>",
|
||||
"<table broken <table><tr><td>&lt;</td></tr></table>",
|
||||
],
|
||||
)
|
||||
def test_damaged_outer_table_does_not_expose_complete_inner_table(markdown: str) -> None:
|
||||
result = transform(markdown)
|
||||
|
||||
assert result.status is RunStatus.SUCCESS
|
||||
assert result.output_markdown == markdown
|
||||
assert result.changes == ()
|
||||
|
||||
|
||||
def test_fenced_table_is_not_protected_by_the_lexical_subset() -> None:
|
||||
markdown = "```html\n<table><tr><td>&lt;</td></tr></table>\n```"
|
||||
assert transform(markdown).output_markdown == "```html\n<table><tr><td><</td></tr></table>\n```"
|
||||
|
||||
@@ -23,6 +23,7 @@ def test_expands_rows_without_changing_tags_attributes_or_cells() -> None:
|
||||
"</table>\nafter"
|
||||
)
|
||||
assert len(result.changes) == 1
|
||||
assert result.modifiers[0].version == "1.0.1"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("line_ending", ["\n", "\r\n", "\r"])
|
||||
@@ -56,6 +57,21 @@ def test_mixed_multiline_or_non_strict_tables_are_preserved(markdown: str) -> No
|
||||
assert transform(markdown).output_markdown == markdown
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"markdown",
|
||||
[
|
||||
"<table>broken<table><tr><td>A</td></tr></table>",
|
||||
"<table broken <table><tr><td>A</td></tr></table>",
|
||||
],
|
||||
)
|
||||
def test_damaged_outer_table_does_not_expose_complete_inner_table(markdown: str) -> None:
|
||||
result = transform(markdown)
|
||||
|
||||
assert result.status is RunStatus.SUCCESS
|
||||
assert result.output_markdown == markdown
|
||||
assert result.changes == ()
|
||||
|
||||
|
||||
def test_successful_output_is_idempotent() -> None:
|
||||
pipeline = Pipeline([html_table_layout()])
|
||||
first = pipeline.transform(TABLE)
|
||||
|
||||
@@ -362,7 +362,7 @@ def test_empty_document_and_empty_rule_set_are_no_ops() -> None:
|
||||
|
||||
|
||||
def test_installed_package_version_matches_delivery_candidate() -> None:
|
||||
assert distribution_version("mdpolish") == "0.6.0"
|
||||
assert distribution_version("mdpolish") == "0.6.1"
|
||||
|
||||
|
||||
def test_parameters_preserve_rule_order_and_record_all_options() -> None:
|
||||
|
||||
Reference in New Issue
Block a user