← Về thư mục
tests/docx/test_scripts.py
- document · function · L39-L43 — def document(body: str) -> str
- run · function · L46-L48 — def run(text: str, *, preserve: bool = False, properties: str = "") -> str
- UnpackedPackage · class · L51-L67 — class UnpackedPackage
- init · method · L54-L58 — def init(self, root: Path, body: str) -> None
- xml · method · L61-L62 — def xml(self) -> str
- visible_text · method · L64-L67 — def visible_text(self) -> str
- MergeRunsTestCase · class · L70-L77 — class MergeRunsTestCase(unittest.TestCase)
- setUp · method · L71-L74 — def setUp(self) -> None
- package · method · L76-L77 — def package(self, body: str) -> UnpackedPackage
- TextPreservationTests · class · L80-L163 — class TextPreservationTests(MergeRunsTestCase)
- test_adjacent_identical_runs_merge_without_changing_the_text · method · L81-L91 — def test_adjacent_identical_runs_merge_without_changing_the_text(self) -> None: # The trailing space needs xml:space="preserve" to be significant -- # without it OOXML says the space is not part of the text, which is # what
office/helpers.rendered_text implements.
- test_unpreserved_trailing_whitespace_is_insignificant · method · L93-L98 — def test_unpreserved_trailing_whitespace_is_insignificant(self) -> None: # The counterpart: without xml:space="preserve" the space is dropped, # matching how Word itself reads the part.
- test_merging_reduces_the_run_count · method · L100-L106 — def test_merging_reduces_the_run_count(self) -> None
- test_runs_with_different_formatting_are_not_merged · method · L108-L115 — def test_runs_with_different_formatting_are_not_merged(self) -> None
- test_preserved_whitespace_survives_a_merge · method · L117-L123 — def test_preserved_whitespace_survives_a_merge(self) -> None: # Losing xml:space="preserve" silently deletes the space between words.
- test_runs_in_different_paragraphs_are_not_merged_across · method · L125-L131 — def test_runs_in_different_paragraphs_are_not_merged_across(self) -> None
- test_a_document_with_nothing_to_merge_keeps_its_content · method · L133-L140 — def test_a_document_with_nothing_to_merge_keeps_its_content(self) -> None: # The XML declaration is rewritten by minidom's serializer, so compare # the document element rather than the whole byte stream.
- test_an_empty_document_does_not_raise · method · L142-L145 — def test_an_empty_document_does_not_raise(self) -> None
- test_the_result_is_still_well_formed_xml · method · L147-L155 — def test_the_result_is_still_well_formed_xml(self) -> None
- test_merging_is_idempotent · method · L157-L163 — def test_merging_is_idempotent(self) -> None
- HelperTests · class · L166-L199 — class HelperTests(unittest.TestCase)
- _runs · method · L169-L174 — def _runs(self, body: str) -> list
- test_adjacency_requires_the_elements_to_be_siblings_in_order · method · L176-L180 — def test_adjacency_requires_the_elements_to_be_siblings_in_order(self) -> None
- test_an_intervening_element_breaks_adjacency · method · L182-L186 — def test_an_intervening_element_breaks_adjacency(self) -> None
- test_element_matching_is_namespace_aware · method · L188-L191 — def test_element_matching_is_namespace_aware(self) -> None
- test_run_tag_names_are_discovered_from_the_document · method · L193-L199 — def test_run_tag_names_are_discovered_from_the_document(self) -> None
- TemplateTests · class · L202-L222 — class TemplateTests(unittest.TestCase)
- test_the_comment_templates_are_shipped_and_parse · method · L203-L210 — def test_the_comment_templates_are_shipped_and_parse(self) -> None
- test_the_documented_comment_parts_are_all_present · method · L212-L222 — def test_the_documented_comment_parts_are_all_present(self) -> None: # Word needs every one of these to open a commented document.