|
9 | 9 |
|
10 | 10 | import pytest |
11 | 11 |
|
| 12 | +from docx.comments import Comments |
12 | 13 | from docx.document import Document, _Body |
13 | 14 | from docx.enum.section import WD_SECTION |
14 | 15 | from docx.enum.text import WD_BREAK |
@@ -164,6 +165,12 @@ def it_can_save_the_document_to_a_file(self, document_part_: Mock): |
164 | 165 |
|
165 | 166 | document_part_.save.assert_called_once_with("foobar.docx") |
166 | 167 |
|
| 168 | + def it_provides_access_to_the_comments(self, document_part_: Mock, comments_: Mock): |
| 169 | + document_part_.comments = comments_ |
| 170 | + document = Document(cast(CT_Document, element("w:document")), document_part_) |
| 171 | + |
| 172 | + assert document.comments is comments_ |
| 173 | + |
167 | 174 | def it_provides_access_to_its_core_properties( |
168 | 175 | self, document_part_: Mock, core_properties_: Mock |
169 | 176 | ): |
@@ -281,6 +288,10 @@ def _block_width_prop_(self, request: FixtureRequest): |
281 | 288 | def body_prop_(self, request: FixtureRequest): |
282 | 289 | return property_mock(request, Document, "_body") |
283 | 290 |
|
| 291 | + @pytest.fixture |
| 292 | + def comments_(self, request: FixtureRequest): |
| 293 | + return instance_mock(request, Comments) |
| 294 | + |
284 | 295 | @pytest.fixture |
285 | 296 | def core_properties_(self, request: FixtureRequest): |
286 | 297 | return instance_mock(request, CoreProperties) |
|
0 commit comments