1313from docx .document import _Body , Document
1414from docx .enum .section import WD_SECTION
1515from docx .enum .text import WD_BREAK
16+ from docx .opc .coreprops import CoreProperties
1617from docx .parts .document import DocumentPart
1718from docx .shape import InlineShape
1819from docx .table import Table
@@ -78,6 +79,11 @@ def it_can_add_a_table(self, add_table_fixture):
7879 assert table == table_
7980 assert table .style == style
8081
82+ def it_provides_access_to_its_core_properties (self , core_props_fixture ):
83+ document , core_properties_ = core_props_fixture
84+ core_properties = document .core_properties
85+ assert core_properties is core_properties_
86+
8187 def it_provides_access_to_the_document_part (self , part_fixture ):
8288 document , part_ = part_fixture
8389 assert document .part is part_
@@ -162,6 +168,12 @@ def body_fixture(self, _Body_, body_):
162168 document = Document (document_elm , None )
163169 return document , body_elm , _Body_ , body_
164170
171+ @pytest .fixture
172+ def core_props_fixture (self , document_part_ , core_properties_ ):
173+ document = Document (None , document_part_ )
174+ document_part_ .core_properties = core_properties_
175+ return document , core_properties_
176+
165177 @pytest .fixture
166178 def part_fixture (self , document_part_ ):
167179 document = Document (None , document_part_ )
@@ -185,6 +197,10 @@ def body_(self, request):
185197 def body_prop_ (self , request , body_ ):
186198 return property_mock (request , Document , '_body' , return_value = body_ )
187199
200+ @pytest .fixture
201+ def core_properties_ (self , request ):
202+ return instance_mock (request , CoreProperties )
203+
188204 @pytest .fixture
189205 def document_part_ (self , request ):
190206 return instance_mock (request , DocumentPart )
0 commit comments