Repository navigation
Commit 46575b6
authored
* test: add foreign track-changes fixtures from docx-revisions (MIT)
Two real-world fixtures copied from
https://github.com/balalofernandez/docx-revisions:
- OXML_TrackChanges_Test.docx: 8 revisions (4 w:ins + 4 w:del) from 6
authors, covering a del+ins replacement pair, an em-dash insertion
next to smart-quote runs, and identical text inserted by one author
and deleted by another in the same paragraph.
- tricky-track-changes.docx: no revisions, but heavily fragmented runs
(proofErr, bookmarks, lastRenderedPageBreak, formatting splits) that
exercise cross-run search the way real Word output does.
THIRD_PARTY_NOTICES records the source and reproduces the upstream MIT
license.
* test: promote replace_document_xml helper to conftest
Move the word/document.xml swap helper from test_paragraph_location.py
to conftest.py under a public name so other test modules can build
synthetic .docx files without duplicating it. No behavior change.
* test: cover foreign revisions, table lifecycle, fragmented-run search
Closes ISSUES.md #13. New tests against the foreign fixtures plus
synthetic documents:
- parse all 8 foreign revisions with exact id/type/author/text/date,
per-author filters, em-dash and smart-quote survival
- accept_all/reject_all end-to-end, per-author accept/reject, and the
conflicting insert/delete pair over identical text
- partial accept survives save + reopen with the rest intact
- rejecting a deletion keeps xml:space="preserve" on the restored w:t
(Word-realistic delText) and attribute-less foreign delText still
round-trips
- tracked edits in table cells and nested tables accept/reject cleanly
- cross-run search over real Word fragmentation (proofErr, bookmarks,
superscript splits), plus find_in_text_map unit tests for many-
fragment matches and matches ending mid-run
Note: the fixture holds 4 w:ins + 4 w:del = 8 revisions total (the
task description's "4 ins + 8 del" was wrong).
* test: make fixture text assertions note-proof, compare Revision objects
Review findings from the multi-reviewer pass:
- The fixture's bracketed note runs quote expected outcomes verbatim,
so several get_visible_text() substring assertions were satisfiable
by a note instead of the body they meant to check. Route all such
assertions through a _body_text() helper that strips the note runs;
the reject-path and round-trip assertions are now genuinely
discriminating and the accept-path assertions can no longer be
satisfied by note text.
- Replace the hand-ordered (id, type, author, text, date) tuples with
Revision instances compared via the dataclass's own __eq__, removing
the silent field reordering against the dataclass definition.
- Simplify the reject_all em-dash check: with notes stripped,
'— or is it?' must be absent outright.
* test: address second review round in foreign-revision tests
- Route the two remaining get_visible_text() assertions (smart-quote
parsing check, tricky-fixture replace integration) through
_body_text() so note runs can't satisfy them.
- Assert revisions 1007/1008 actually leave list_revisions() after the
conflicting-pair accepts.
- Construct EXPECTED_REVISIONS with keyword arguments, matching the
Revision construction convention in test_track_changes.py.
- Fix inaccurate comments/docstrings: the pending-state body reads
'This sentence remains.' (single space); 'Quick Brown' has no note
occurrence; the notes describe outcomes approximately, not verbatim.
* test: apply final review-round nits
- Guard against a doubled DRAFT after accept_all.
- Verify Test Author's rejected insertion is gone from the body in the
author-filtered reject test, not just the restored deletion.
- Correct the 'Quick Brown' comment/docstring: it is a single-run match
guarding against the note's 'ick Brown', not a fragmented one.
1 parent e580508 commit 46575b6
7 files changed
Lines changed: 479 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
19 | 31 | | |
20 | 32 | | |
21 | 33 | | |
| |||
Binary file not shown.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
Binary file not shown.
0 commit comments