77import pytest
88
99from docx .enum .style import WD_STYLE_TYPE
10+ from docx .package import Package
1011from docx .parts .document import DocumentPart
1112from docx .parts .story import BaseStoryPart
1213from docx .styles .style import BaseStyle
@@ -29,6 +30,14 @@ def it_can_get_a_style_id_by_style_or_name_and_type(
2930 document_part_ .get_style_id .assert_called_once_with (style_ , style_type )
3031 assert style_id == "BodyText"
3132
33+ def it_knows_the_main_document_part_to_help (self , package_ , document_part_ ):
34+ package_ .main_document_part = document_part_
35+ story_part = BaseStoryPart (None , None , None , package_ )
36+
37+ document_part = story_part ._document_part
38+
39+ assert document_part is document_part_
40+
3241 # fixture components ---------------------------------------------
3342
3443 @pytest .fixture
@@ -39,6 +48,10 @@ def document_part_(self, request):
3948 def _document_part_prop_ (self , request ):
4049 return property_mock (request , BaseStoryPart , "_document_part" )
4150
51+ @pytest .fixture
52+ def package_ (self , request ):
53+ return instance_mock (request , Package )
54+
4255 @pytest .fixture
4356 def style_ (self , request ):
4457 return instance_mock (request , BaseStyle )
0 commit comments