(
self,
document_part_: Mock,
comments_prop_: Mock,
comments_: Mock,
comment_: Mock,
run_mark_comment_range_: Mock,
)
| 40 | """Unit-test suite for `docx.document.Document`.""" |
| 41 | |
| 42 | def it_can_add_a_comment( |
| 43 | self, |
| 44 | document_part_: Mock, |
| 45 | comments_prop_: Mock, |
| 46 | comments_: Mock, |
| 47 | comment_: Mock, |
| 48 | run_mark_comment_range_: Mock, |
| 49 | ): |
| 50 | comment_.comment_id = 42 |
| 51 | comments_.add_comment.return_value = comment_ |
| 52 | comments_prop_.return_value = comments_ |
| 53 | document = Document(cast(CT_Document, element("w:document/w:body/w:p/w:r")), document_part_) |
| 54 | run = document.paragraphs[0].runs[0] |
| 55 | |
| 56 | comment = document.add_comment(run, "Comment text.") |
| 57 | |
| 58 | comments_.add_comment.assert_called_once_with("Comment text.", "", "") |
| 59 | run_mark_comment_range_.assert_called_once_with(run, run, 42) |
| 60 | assert comment is comment_ |
| 61 | |
| 62 | @pytest.mark.parametrize( |
| 63 | ("level", "style"), [(0, "Title"), (1, "Heading 1"), (2, "Heading 2"), (9, "Heading 9")] |
nothing calls this directly
no test coverage detected