<s> """<STR_LIT>""" <EOL> from __future__ import absolute_import <EOL> from behave import given , then , when <EOL> from pptx import Presentation <EOL> from pptx . enum . text import MSO_UNDERLINE <EOL> from helpers import test_pptx <EOL> @ given ( '<STR_LIT>' ) <EOL> def given_a_font ( context ) : <EOL> prs = Presentation ( test_pptx ( '<STR_LIT>' ) ) <EOL> slide = prs . slides [ <NUM_LIT:1> ] <EOL> textbox = slide . shapes [ <NUM_LIT:0> ] <EOL> run = textbox . text_frame . paragraphs [ <NUM_LIT:0> ] . runs [ <NUM_LIT:0> ] <EOL> context . font = run . font <EOL> @ given ( '<STR_LIT>' ) <EOL> def given_a_font_having_applied_size ( context , applied_size ) : <EOL> shape_idx = { <EOL> '<STR_LIT>' : <NUM_LIT:0> , <EOL> '<STR_LIT>' : <NUM_LIT:1> , <EOL> } [ applied_size ] <EOL> prs = Presentation ( test_pptx ( '<STR_LIT>' ) ) <EOL> slide = prs . slides [ <NUM_LIT:1> ] <EOL> textbox = slide . shapes [ shape_idx ] <EOL> run = textbox . text_frame . paragraphs [ <NUM_LIT:0> ] . runs [ <NUM_LIT:0> ] <EOL> context . font = run . font <EOL> @ given ( '<STR_LIT>' ) <EOL> def given_a_font_with_bold_set_state ( context , state ) : <EOL> shape_idx = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] . index ( state ) <EOL> prs = Presentation ( test_pptx ( '<STR_LIT>' ) ) <EOL> paragraph = prs . slides [ <NUM_LIT:2> ] . shapes [ shape_idx ] . text_frame . paragraphs [ <NUM_LIT:0> ] <EOL> context . font = paragraph . runs [ <NUM_LIT:0> ] . font <EOL> @ given ( '<STR_LIT>' ) <EOL> def given_run_with_italic_set_to_state ( context , state ) : <EOL> run_idx = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] . index ( state ) <EOL> prs = Presentation ( test_pptx ( '<STR_LIT>' ) ) <EOL> runs = prs . slides [ <NUM_LIT:0> ] . shapes [ <NUM_LIT:0> ] . text_frame . paragraphs [ <NUM_LIT:0> ] . runs <EOL> context . font = runs [ run_idx ] . font <EOL> @ given ( '<STR_LIT>' ) <EOL> def given_run_with_underline_set_to_state ( context , state ) : <EOL> run_idx = [ <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' <EOL> ] . index ( state ) <EOL> prs = Presentation ( test_pptx ( '<STR_LIT>' ) ) <EOL> runs = prs . slides [ <NUM_LIT:3> ] . shapes [ <NUM_LIT:0> ] . text_frame . paragraphs [ <NUM_LIT:0> ] . runs <EOL> context . font = runs [ run_idx ] . font <EOL> @ when ( '<STR_LIT>' ) <EOL> def when_I_assign_value_to_font_bold ( context , value ) : <EOL> new_value = { '<STR_LIT:True>' : True , '<STR_LIT:False>' : False , '<STR_LIT:None>' : None } [ value ] <EOL> context . font . bold = new_value <EOL> @ when ( '<STR_LIT>' ) <EOL> def when_I_assign_value_to_font_italic ( context , value ) : <EOL> new_value = { '<STR_LIT:True>' : True , '<STR_LIT:False>' : False , '<STR_LIT:None>' : None } [ value ] <EOL> context . font . italic = new_value <EOL> @ when ( '<STR_LIT>' ) <EOL> def when_I_assign_value_to_font_underline ( context , value ) : <EOL> new_value = { <EOL> '<STR_LIT:True>' : True , <EOL> '<STR_LIT:False>' : False , <EOL> '<STR_LIT:None>' : None , <EOL> '<STR_LIT>' : MSO_UNDERLINE . DOUBLE_LINE , <EOL> '<STR_LIT>' : MSO_UNDERLINE . NONE , <EOL> '<STR_LIT>' : MSO_UNDERLINE . SINGLE_LINE , <EOL> } [ value ] <EOL> context . font . underline = new_value <EOL> @ then ( '<STR_LIT>' ) <EOL> def then_font_bold_is_value ( context , value ) : <EOL> expected_value = { '<STR_LIT:True>' : True , '<STR_LIT:False>' : False , '<STR_LIT:None>' : None } [ value ] <EOL> font = context . font <EOL> assert font . bold is expected_value <EOL> @ then ( '<STR_LIT>' ) <EOL> def then_font_italic_is_value ( context , value ) : <EOL> expected_value = { '<STR_LIT:True>' : True , '<STR_LIT:False>' : False , '<STR_LIT:None>' : None } [ value ] <EOL> font = context . font <EOL> assert font . italic is expected_value <EOL> @ then ( '<STR_LIT>' ) <EOL> def then_font_size_is_value ( context , value_str ) : <EOL> expected_value = { '<STR_LIT>' : <NUM_LIT> , '<STR_LIT:None>' : None } [ value_str ] <EOL> font = context . font <EOL> value = font . size if font . size is None else font . size . pt <EOL> assert value == expected_value , ( <EOL> '<STR_LIT>' % ( expected_value , value ) <EOL> ) <EOL> @ then ( '<STR_LIT>' ) <EOL> def then_font_underline_is_value ( context , value ) : <EOL> expected_value = { <EOL> '<STR_LIT:True>' : True , <EOL> '<STR_LIT:False>' : False , <EOL> '<STR_LIT:None>' : None , <EOL> '<STR_LIT>' : MSO_UNDERLINE . DOUBLE_LINE , <EOL> '<STR_LIT>' : MSO_UNDERLINE . SINGLE_LINE , <EOL> '<STR_LIT>' : MSO_UNDERLINE . WAVY_LINE , <EOL> } [ value ] <EOL> font = context . font <EOL> assert font . underline is expected_value </s>
