def it_can_insert_a_table_into_itself(self, request): graphicFrame = element("p:graphicFrame") _new_placeholder_table_ = method_mock( request, TablePlaceholder, "_new_placeholder_table", return_value=graphicFrame, ) _replace_placeholder_with_ = method_mock(request, TablePlaceholder, "_replace_placeholder_with") placeholder_graphic_frame_ = instance_mock(request, PlaceholderGraphicFrame) PlaceholderGraphicFrame_ = class_mock( request, "pptx.shapes.placeholder.PlaceholderGraphicFrame", return_value=placeholder_graphic_frame_, ) table_ph = TablePlaceholder(None, "parent") ph_graphic_frame = table_ph.insert_table(4, 2) _new_placeholder_table_.assert_called_once_with(table_ph, 4, 2) _replace_placeholder_with_.assert_called_once_with( table_ph, graphicFrame) PlaceholderGraphicFrame_.assert_called_once_with( graphicFrame, table_ph._parent) assert ph_graphic_frame is placeholder_graphic_frame_
def new_fixture(self): sp_cxml = ( 'p:sp/(p:nvSpPr/p:cNvPr{id=2,name=foo},p:spPr/a:xfrm/(a:off{x=1,' 'y=2},a:ext{cx=3,cy=4}))') table_ph = TablePlaceholder(element(sp_cxml), None) rows, cols = 1, 1 expected_xml = snippet_seq('placeholders')[0] return table_ph, rows, cols, expected_xml
def insert_fixture(self, PlaceholderGraphicFrame_, placeholder_graphic_frame_, _new_placeholder_table_, _replace_placeholder_with_): table_ph = TablePlaceholder(None, 'parent') rows, cols, graphicFrame = 4, 2, element('p:graphicFrame') _new_placeholder_table_.return_value = graphicFrame PlaceholderGraphicFrame_.return_value = placeholder_graphic_frame_ return (table_ph, rows, cols, graphicFrame, PlaceholderGraphicFrame_, placeholder_graphic_frame_)
def it_creates_a_graphicFrame_element_to_help(self): table_ph = TablePlaceholder( element( "p:sp/(p:nvSpPr/p:cNvPr{id=2,name=foo},p:spPr/a:xfrm/(a:off{x=1,y=2}," "a:ext{cx=3,cy=4}))"), None, ) graphicFrame = table_ph._new_placeholder_table(1, 1) assert graphicFrame.xml == snippet_seq("placeholders")[0]