<s> """<STR_LIT>""" <EOL> from __future__ import absolute_import , print_function , unicode_literals <EOL> import pytest <EOL> from pptx . dml . color import ColorFormat <EOL> from pptx . dml . fill import FillFormat <EOL> from pptx . dml . line import LineFormat <EOL> from pptx . enum . dml import MSO_FILL <EOL> from pptx . oxml . shapes . shared import CT_LineProperties <EOL> from pptx . shapes . autoshape import Shape <EOL> from . . oxml . unitdata . dml import an_ln <EOL> from . . unitutil . mock import call , class_mock , instance_mock , property_mock <EOL> class DescribeLineFormat ( object ) : <EOL> def it_knows_the_line_width ( self , width_get_fixture ) : <EOL> line , expected_line_width = width_get_fixture <EOL> assert line . width == expected_line_width <EOL> def it_can_change_its_width ( self , width_set_fixture ) : <EOL> line , width , expected_xml = width_set_fixture <EOL> line . width = width <EOL> assert line . _ln . xml == expected_xml <EOL> def it_has_a_fill ( self , fill_fixture ) : <EOL> line , FillFormat_ , ln_ , fill_ = fill_fixture <EOL> fill = line . fill <EOL> FillFormat_ . from_fill_parent . assert_called_once_with ( ln_ ) <EOL> assert fill is fill_ <EOL> def it_has_a_color ( self , color_fixture ) : <EOL> line , fill_ , expected_solid_calls , color_ = color_fixture <EOL> color = line . color <EOL> assert fill_ . solid . mock_calls == expected_solid_calls <EOL> assert color is color_ <EOL> @ pytest . fixture ( params = [ <EOL> ( MSO_FILL . SOLID , False ) , <EOL> ( MSO_FILL . BACKGROUND , True ) , <EOL> ( None , True ) , <EOL> ] ) <EOL> def color_fixture ( self , request , line , fill_prop_ , fill_ , color_ ) : <EOL> pre_call_fill_type , solid_call_expected = request . param <EOL> fill_ . type = pre_call_fill_type <EOL> expected_solid_calls = [ call ( ) ] if solid_call_expected else [ ] <EOL> return line , fill_ , expected_solid_calls , color_ <EOL> @ pytest . fixture <EOL> def fill_fixture ( self , line , FillFormat_ , ln_ , fill_ ) : <EOL> return line , FillFormat_ , ln_ , fill_ <EOL> @ pytest . fixture ( params = [ ( None , <NUM_LIT:0> ) , ( <NUM_LIT> , <NUM_LIT> ) ] ) <EOL> def width_get_fixture ( self , request , shape_ ) : <EOL> w , expected_line_width = request . param <EOL> shape_ . ln = self . ln_bldr ( w ) . element <EOL> line = LineFormat ( shape_ ) <EOL> return line , expected_line_width <EOL> @ pytest . fixture ( params = [ <EOL> ( None , None ) , ( None , <NUM_LIT> ) , ( <NUM_LIT> , <NUM_LIT> ) , ( <NUM_LIT> , <NUM_LIT> ) , <EOL> ( <NUM_LIT> , None ) , <EOL> ] ) <EOL> def width_set_fixture ( self , request , shape_ ) : <EOL> initial_width , width = request . param <EOL> shape_ . ln = shape_ . get_or_add_ln . return_value = ( <EOL> self . ln_bldr ( initial_width ) . element <EOL> ) <EOL> line = LineFormat ( shape_ ) <EOL> expected_xml = self . ln_bldr ( width ) . xml ( ) <EOL> return line , width , expected_xml <EOL> @ pytest . fixture <EOL> def color_ ( self , request ) : <EOL> return instance_mock ( request , ColorFormat ) <EOL> @ pytest . fixture <EOL> def fill_ ( self , request , color_ ) : <EOL> return instance_mock ( request , FillFormat , fore_color = color_ ) <EOL> @ pytest . fixture <EOL> def fill_prop_ ( self , request , fill_ ) : <EOL> return property_mock ( request , LineFormat , '<STR_LIT>' , return_value = fill_ ) <EOL> @ pytest . fixture <EOL> def FillFormat_ ( self , request , fill_ ) : <EOL> FillFormat_ = class_mock ( request , '<STR_LIT>' ) <EOL> FillFormat_ . from_fill_parent . return_value = fill_ <EOL> return FillFormat_ <EOL> @ pytest . fixture <EOL> def line ( self , shape_ ) : <EOL> return LineFormat ( shape_ ) <EOL> @ pytest . fixture <EOL> def ln_ ( self , request ) : <EOL> return instance_mock ( request , CT_LineProperties ) <EOL> def ln_bldr ( self , w ) : <EOL> ln_bldr = an_ln ( ) . with_nsdecls ( ) <EOL> if w is not None : <EOL> ln_bldr . with_w ( w ) <EOL> return ln_bldr <EOL> @ pytest . fixture <EOL> def shape_ ( self , request , ln_ ) : <EOL> shape_ = instance_mock ( request , Shape ) <EOL> shape_ . get_or_add_ln . return_value = ln_ <EOL> return shape_ </s>
