Problem
The QuickBook format handler (item 2) must be validated against Weblate's format contract. Tests must verify round-trip fidelity, monolingual behavior, extension autodetection, and correct interaction with the Weblate translation unit API. Without these tests, format handler bugs could silently corrupt translations.
Acceptance Criteria
Implementation Notes
- Create at least 3 fixture files: a minimal single-section file, a complex file with tables/code/images, and an empty file.
- If Weblate's test infrastructure provides a
BaseFormatTest mixin, consider subclassing it for contract conformance.
- These tests validate the format handler's Weblate integration; William's
tests/utils/test_quickbook.py (item 9) validates the underlying parser independently.
- Use
pytest-tmp-files or tmp_path fixture for any write-back tests.
References
- Related files:
tests/formats/test_quickbook.py, tests/fixtures/*.qbk, src/boost_weblate/formats/quickbook.py
- Upstream:
weblate/formats/tests/test_txt.py for test patterns
Problem
The QuickBook format handler (item 2) must be validated against Weblate's format contract. Tests must verify round-trip fidelity, monolingual behavior, extension autodetection, and correct interaction with the Weblate translation unit API. Without these tests, format handler bugs could silently corrupt translations.
Acceptance Criteria
tests/formats/test_quickbook.pyexists with pytest-style test functions.qbkfixture file viaQuickBookFormat.load(), thensave()— output matches input byte-for-byteQuickBookFormat.monolingualisTrueand thatload()produces units withsourcepopulated andtargetemptyautodetect_extensionstest: verify(".qbk",)is returnedformat_idtest: verify the format returns"quickbook"nametest: verify human-readable name is returnedtests/fixtures/as.qbkfilesImplementation Notes
BaseFormatTestmixin, consider subclassing it for contract conformance.tests/utils/test_quickbook.py(item 9) validates the underlying parser independently.pytest-tmp-filesortmp_pathfixture for any write-back tests.References
tests/formats/test_quickbook.py,tests/fixtures/*.qbk,src/boost_weblate/formats/quickbook.pyweblate/formats/tests/test_txt.pyfor test patterns