@@ -320,69 +320,14 @@ def tables_(self, request):
320320
321321class Describe_Body (object ):
322322
323- def it_can_add_a_paragraph (self , add_paragraph_fixture ):
324- body , expected_xml = add_paragraph_fixture
325- p = body .add_paragraph ()
326- assert body ._body .xml == expected_xml
327- assert isinstance (p , Paragraph )
328-
329- def it_can_add_a_table (self , add_table_fixture ):
330- body , rows , cols , expected_xml = add_table_fixture
331- table = body .add_table (rows , cols )
332- assert body ._element .xml == expected_xml
333- assert isinstance (table , Table )
334-
335323 def it_can_clear_itself_of_all_content_it_holds (self , clear_fixture ):
336324 body , expected_xml = clear_fixture
337325 _body = body .clear_content ()
338326 assert body ._body .xml == expected_xml
339327 assert _body is body
340328
341- def it_provides_access_to_the_paragraphs_it_contains (
342- self , paragraphs_fixture ):
343- body = paragraphs_fixture
344- paragraphs = body .paragraphs
345- assert len (paragraphs ) == 2
346- for p in paragraphs :
347- assert isinstance (p , Paragraph )
348-
349- def it_provides_access_to_the_tables_it_contains (self , tables_fixture ):
350- body = tables_fixture
351- tables = body .tables
352- assert len (tables ) == 2
353- for table in tables :
354- assert isinstance (table , Table )
355-
356329 # fixtures -------------------------------------------------------
357330
358- @pytest .fixture (params = [
359- ('w:body' , 'w:body/w:p' ),
360- ('w:body/w:p' , 'w:body/(w:p, w:p)' ),
361- ('w:body/w:sectPr' , 'w:body/(w:p, w:sectPr)' ),
362- ('w:body/(w:p, w:sectPr)' , 'w:body/(w:p, w:p, w:sectPr)' ),
363- ])
364- def add_paragraph_fixture (self , request ):
365- before_cxml , after_cxml = request .param
366- body = _Body (element (before_cxml ), None )
367- expected_xml = xml (after_cxml )
368- return body , expected_xml
369-
370- @pytest .fixture (params = [
371- ('w:body' , 0 , 0 , 'w:body/w:tbl/(w:tblPr/w:tblW{w:type=auto,w:w=0},w:'
372- 'tblGrid)' ),
373- ('w:body' , 1 , 0 , 'w:body/w:tbl/(w:tblPr/w:tblW{w:type=auto,w:w=0},w:'
374- 'tblGrid,w:tr)' ),
375- ('w:body' , 0 , 1 , 'w:body/w:tbl/(w:tblPr/w:tblW{w:type=auto,w:w=0},w:'
376- 'tblGrid/w:gridCol)' ),
377- ('w:body' , 1 , 1 , 'w:body/w:tbl/(w:tblPr/w:tblW{w:type=auto,w:w=0},w:'
378- 'tblGrid/w:gridCol,w:tr/w:tc/w:p)' ),
379- ])
380- def add_table_fixture (self , request ):
381- body_cxml , rows , cols , after_cxml = request .param
382- body = _Body (element (body_cxml ), None )
383- expected_xml = xml (after_cxml )
384- return body , rows , cols , expected_xml
385-
386331 @pytest .fixture (params = [
387332 ('w:body' , 'w:body' ),
388333 ('w:body/w:p' , 'w:body' ),
@@ -394,11 +339,3 @@ def clear_fixture(self, request):
394339 body = _Body (element (before_cxml ), None )
395340 expected_xml = xml (after_cxml )
396341 return body , expected_xml
397-
398- @pytest .fixture
399- def paragraphs_fixture (self ):
400- return _Body (element ('w:body/(w:p, w:p)' ), None )
401-
402- @pytest .fixture
403- def tables_fixture (self ):
404- return _Body (element ('w:body/(w:tbl, w:tbl)' ), None )
0 commit comments