@@ -28,21 +28,19 @@ def given_a_document_having_no_styles_part(context):
2828 context .document = Document (docx_path )
2929
3030
31- @given ('a style having a known style id ' )
32- def given_a_style_having_a_known_style_id (context ):
31+ @given ('a style having a known {attr_name} ' )
32+ def given_a_style_having_a_known_attr_name (context , attr_name ):
3333 docx_path = test_docx ('sty-having-styles-part' )
3434 document = Document (docx_path )
3535 context .style = document .styles ['Normal' ]
3636
3737
38- @given ('a style having a known type' )
39- def given_a_style_having_a_known_type (context ):
40- docx_path = test_docx ('sty-having-styles-part' )
41- document = Document (docx_path )
42- context .style = document .styles ['Normal' ]
38+ # when =====================================================
4339
40+ @when ('I assign a new name to the style' )
41+ def when_I_assign_a_new_name_to_the_style (context ):
42+ context .style .name = 'Foobar'
4443
45- # when =====================================================
4644
4745@when ('I assign a new value to style.style_id' )
4846def when_I_assign_a_new_value_to_style_style_id (context ):
@@ -84,6 +82,16 @@ def then_len_styles_is_style_count(context, style_count_str):
8482 assert len (context .document .styles ) == int (style_count_str )
8583
8684
85+ @then ('style.name is the {which} name' )
86+ def then_style_name_is_the_which_name (context , which ):
87+ expected_name = {
88+ 'known' : 'Normal' ,
89+ 'new' : 'Foobar' ,
90+ }[which ]
91+ style = context .style
92+ assert style .name == expected_name
93+
94+
8795@then ('style.style_id is the {which} style id' )
8896def then_style_style_id_is_the_which_style_id (context , which ):
8997 expected_style_id = {
0 commit comments