@@ -100,6 +100,19 @@ def it_gets_a_style_id_from_a_name_to_help(self, id_name_fixture):
100100 )
101101 assert style_id is style_id_
102102
103+ def it_gets_a_style_id_from_a_style_to_help (self , id_style_fixture ):
104+ styles , style_ , style_type , style_id_ = id_style_fixture
105+
106+ style_id = styles ._get_style_id_from_style (style_ , style_type )
107+
108+ styles .default .assert_called_once_with (style_type )
109+ assert style_id is style_id_
110+
111+ def it_raises_on_style_type_mismatch (self , id_style_raises_fixture ):
112+ styles , style_ , style_type = id_style_raises_fixture
113+ with pytest .raises (ValueError ):
114+ styles ._get_style_id_from_style (style_ , style_type )
115+
103116 # fixture --------------------------------------------------------
104117
105118 @pytest .fixture (params = [
@@ -220,6 +233,23 @@ def id_name_fixture(self, _getitem_, _get_style_id_from_style_, style_):
220233 _get_style_id_from_style_ .return_value = style_id_
221234 return styles , style_name , style_type , style_ , style_id_
222235
236+ @pytest .fixture (params = [True , False ])
237+ def id_style_fixture (self , request , default_ , style_ ):
238+ style_is_default = request .param
239+ styles = Styles (None )
240+ style_id , style_type = 'FooBar' , 1
241+ default_ .return_value = style_ if style_is_default else None
242+ style_ .style_id , style_ .type = style_id , style_type
243+ expected_value = None if style_is_default else style_id
244+ return styles , style_ , style_type , expected_value
245+
246+ @pytest .fixture
247+ def id_style_raises_fixture (self , style_ ):
248+ styles = Styles (None )
249+ style_ .type = 1
250+ style_type = 2
251+ return styles , style_ , style_type
252+
223253 @pytest .fixture (params = [
224254 ('w:styles' , 0 ),
225255 ('w:styles/w:style' , 1 ),
0 commit comments