Skip to content

Commit 7635483

Browse files
committed
test: increase code coverage from 74% to 98%
Add comprehensive tests for all modules: - xml_editor.py: error handling, utility functions, edge cases - track_changes.py: revision parsing, accept/reject operations - comments.py: comment operations, error handling - workspace.py: sync checks, error paths - document.py: settings updates, relationship handling - ooxml/pack.py and unpack.py: error cases Mark LibreOffice validation code as pragma: no cover since it requires external tools not available in CI.
1 parent d21cfe1 commit 7635483

8 files changed

Lines changed: 3709 additions & 2 deletions

File tree

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ coverage.xml
5454
.hypothesis/
5555
.pytest_cache/
5656
cover/
57+
tests/test_data/.docx
5758

5859
# Translations
5960
*.mo

‎docx_editor/ooxml/pack.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@ def pack_document(input_dir: str | Path, output_file: str | Path, validate: bool
5050
zf.write(f, f.relative_to(temp_content_dir))
5151

5252
# Validate if requested
53-
if validate:
53+
if validate: # pragma: no cover
5454
if not validate_document(output_file):
5555
output_file.unlink() # Delete the corrupt file
5656
return False
5757

5858
return True
5959

6060

61-
def validate_document(doc_path: Path) -> bool:
61+
def validate_document(doc_path: Path) -> bool: # pragma: no cover
6262
"""Validate document by converting to HTML with soffice."""
6363
# Determine the correct filter based on file extension
6464
match doc_path.suffix.lower():

0 commit comments

Comments
 (0)