@@ -168,10 +168,16 @@ def it_provides_access_to_the_column_cells(self, column):
168168 cells = column .cells
169169 assert isinstance (cells , _ColumnCells )
170170
171- def it_knows_its_width_in_EMU (self , width_fixture ):
172- column , expected_width = width_fixture
171+ def it_knows_its_width_in_EMU (self , width_get_fixture ):
172+ column , expected_width = width_get_fixture
173173 assert column .width == expected_width
174174
175+ def it_can_change_its_width (self , width_set_fixture ):
176+ column , value , expected_xml = width_set_fixture
177+ column .width = value
178+ assert column .width == value
179+ assert column ._gridCol .xml == expected_xml
180+
175181 # fixtures -------------------------------------------------------
176182
177183 @pytest .fixture (params = [
@@ -182,21 +188,37 @@ def it_knows_its_width_in_EMU(self, width_fixture):
182188 ('12.5pt' , 158750 ),
183189 (None , None ),
184190 ])
185- def width_fixture (self , request ):
191+ def width_get_fixture (self , request ):
186192 w , expected_width = request .param
187- gridCol_bldr = a_gridCol ().with_nsdecls ()
188- if w is not None :
189- gridCol_bldr .with_w (w )
190- gridCol = gridCol_bldr .element
193+ gridCol = self .gridCol_bldr (w ).element
191194 column = _Column (gridCol , None )
192195 return column , expected_width
193196
197+ @pytest .fixture (params = [
198+ (4242 , None , None ),
199+ (None , None , None ),
200+ (4242 , 914400 , 1440 ),
201+ (None , 914400 , 1440 ),
202+ ])
203+ def width_set_fixture (self , request ):
204+ initial_w , value , expected_w = request .param
205+ gridCol = self .gridCol_bldr (initial_w ).element
206+ column = _Column (gridCol , None )
207+ expected_xml = self .gridCol_bldr (expected_w ).xml ()
208+ return column , value , expected_xml
209+
194210 # fixture components ---------------------------------------------
195211
196212 @pytest .fixture
197213 def column (self ):
198214 return _Column (None , None )
199215
216+ def gridCol_bldr (self , w = None ):
217+ gridCol_bldr = a_gridCol ().with_nsdecls ()
218+ if w is not None :
219+ gridCol_bldr .with_w (w )
220+ return gridCol_bldr
221+
200222
201223class Describe_ColumnCells (object ):
202224
0 commit comments