@@ -66,6 +66,13 @@ def it_can_grow_itself_to_help_merge(self, grow_to_fixture):
6666 tc ._grow_to (width , height , top_tc )
6767 assert tc ._span_to_width .call_args_list == expected_calls
6868
69+ def it_can_extend_its_horz_span_to_help_merge (self , span_width_fixture ):
70+ tc , grid_width , top_tc , vMerge , expected_calls = span_width_fixture
71+ tc ._span_to_width (grid_width , top_tc , vMerge )
72+ tc ._move_content_to .assert_called_once_with (top_tc )
73+ assert tc ._swallow_next_tc .call_args_list == expected_calls
74+ assert tc .vMerge == vMerge
75+
6976 def it_raises_on_tr_above (self , tr_above_raise_fixture ):
7077 tc = tr_above_raise_fixture
7178 with pytest .raises (ValueError ):
@@ -154,9 +161,20 @@ def span_raise_fixture(self, request):
154161 tbl = self ._snippet_tbl (snippet_idx )
155162 tc = tbl .tr_lst [row ].tc_lst [col ]
156163 tc_2 = tbl .tr_lst [row_2 ].tc_lst [col_2 ]
157- print (tc .top , tc_2 .top , tc .bottom , tc_2 .bottom )
158164 return tc , tc_2
159165
166+ @pytest .fixture
167+ def span_width_fixture (
168+ self , top_tc_ , grid_span_ , _move_content_to_ , _swallow_next_tc_ ):
169+ tc = element ('w:tc' )
170+ grid_span_ .side_effect = [1 , 3 , 4 ]
171+ grid_width , vMerge = 4 , 'continue'
172+ expected_calls = [
173+ call (grid_width , top_tc_ ),
174+ call (grid_width , top_tc_ )
175+ ]
176+ return tc , grid_width , top_tc_ , vMerge , expected_calls
177+
160178 @pytest .fixture (params = [(0 , 0 , 0 ), (4 , 0 , 0 )])
161179 def tr_above_raise_fixture (self , request ):
162180 snippet_idx , row_idx , col_idx = request .param
@@ -166,10 +184,18 @@ def tr_above_raise_fixture(self, request):
166184
167185 # fixture components ---------------------------------------------
168186
187+ @pytest .fixture
188+ def grid_span_ (self , request ):
189+ return property_mock (request , CT_Tc , 'grid_span' )
190+
169191 @pytest .fixture
170192 def _grow_to_ (self , request ):
171193 return method_mock (request , CT_Tc , '_grow_to' )
172194
195+ @pytest .fixture
196+ def _move_content_to_ (self , request ):
197+ return method_mock (request , CT_Tc , '_move_content_to' )
198+
173199 @pytest .fixture
174200 def _span_dimensions_ (self , request ):
175201 return method_mock (request , CT_Tc , '_span_dimensions' )
@@ -185,6 +211,10 @@ def _snippet_tbl(self, idx):
185211 """
186212 return parse_xml (snippet_seq ('tbl-cells' )[idx ])
187213
214+ @pytest .fixture
215+ def _swallow_next_tc_ (self , request ):
216+ return method_mock (request , CT_Tc , '_swallow_next_tc' )
217+
188218 @pytest .fixture
189219 def _tbl_ (self , request ):
190220 return property_mock (request , CT_Tc , '_tbl' )
0 commit comments