|
9 | 9 | import pytest |
10 | 10 |
|
11 | 11 | from docx.opc.constants import RELATIONSHIP_TYPE as RT |
| 12 | +from docx.opc.coreprops import CoreProperties |
12 | 13 | from docx.oxml.parts.document import CT_Body |
13 | 14 | from docx.oxml.text.run import CT_R |
14 | 15 | from docx.package import ImageParts, Package |
@@ -61,6 +62,11 @@ def it_provides_access_to_the_document_styles(self, styles_fixture): |
61 | 62 | styles = document_part.styles |
62 | 63 | assert styles is styles_ |
63 | 64 |
|
| 65 | + def it_provides_access_to_its_core_properties(self, core_props_fixture): |
| 66 | + document_part, core_properties_ = core_props_fixture |
| 67 | + core_properties = document_part.core_properties |
| 68 | + assert core_properties is core_properties_ |
| 69 | + |
64 | 70 | def it_provides_access_to_the_inline_shapes_in_the_document( |
65 | 71 | self, inline_shapes_fixture): |
66 | 72 | document, InlineShapes_, body_elm = inline_shapes_fixture |
@@ -132,6 +138,12 @@ def body_fixture(self, _Body_): |
132 | 138 | document_part = DocumentPart(None, None, document_elm, None) |
133 | 139 | return document_part, _Body_, body_elm |
134 | 140 |
|
| 141 | + @pytest.fixture |
| 142 | + def core_props_fixture(self, package_, core_properties_): |
| 143 | + document_part = DocumentPart(None, None, None, package_) |
| 144 | + package_.core_properties = core_properties_ |
| 145 | + return document_part, core_properties_ |
| 146 | + |
135 | 147 | @pytest.fixture |
136 | 148 | def get_style_fixture(self, styles_prop_, style_): |
137 | 149 | document_part = DocumentPart(None, None, None, None) |
@@ -220,6 +232,10 @@ def _Body_(self, request): |
220 | 232 | def body_(self, request): |
221 | 233 | return instance_mock(request, _Body) |
222 | 234 |
|
| 235 | + @pytest.fixture |
| 236 | + def core_properties_(self, request): |
| 237 | + return instance_mock(request, CoreProperties) |
| 238 | + |
223 | 239 | @pytest.fixture |
224 | 240 | def document_part_body_(self, request, body_): |
225 | 241 | return property_mock( |
|
0 commit comments