def replace_fixture(self): spTree = element('p:spTree/p:sp/p:nvSpPr/p:nvPr/p:ph{type=pic,idx=10}') pic = element('p:pic/p:nvPicPr/p:nvPr') placeholder = _BaseSlidePlaceholder(spTree[0], None) expected_xml = xml( 'p:spTree/p:pic/p:nvPicPr/p:nvPr/p:ph{type=pic,idx=10}') return placeholder, pic, spTree, expected_xml
def base_ph_fixture(self, request, part_prop_, slide_layout_, layout_placeholder_): sp_cxml = 'p:sp/p:nvSpPr/p:nvPr/p:ph{type=pic,idx=1}' placeholder = _BaseSlidePlaceholder(element(sp_cxml), None) part_prop_.return_value.slide_layout = slide_layout_ slide_layout_.placeholders.get.return_value = layout_placeholder_ return placeholder, slide_layout_, 1, layout_placeholder_
def layout_ph_fixture(self, request, _slide_layout_prop_, slide_layout_, layout_placeholder_): sp_cxml = 'p:sp/p:nvSpPr/p:nvPr/p:ph{type=pic,idx=1}' placeholder = _BaseSlidePlaceholder(element(sp_cxml), None) _slide_layout_prop_.return_value = slide_layout_ slide_layout_.placeholders.get.return_value = layout_placeholder_ return placeholder, slide_layout_, 1, layout_placeholder_
def base_val_fixture(self, request, _base_placeholder_prop_, layout_placeholder_): has_base_placeholder, expected_value = request.param placeholder = _BaseSlidePlaceholder(None, None) if has_base_placeholder: layout_placeholder_.width = expected_value _base_placeholder_prop_.return_value = layout_placeholder_ else: _base_placeholder_prop_.return_value = None return placeholder, "width", expected_value
def replace_fixture(self): spTree = element( 'p:spTree/p:sp/p:nvSpPr/p:nvPr/p:ph{type=pic,idx=10}' ) pic = element('p:pic/p:nvPicPr/p:nvPr') placeholder = _BaseSlidePlaceholder(spTree[0], None) expected_xml = xml( 'p:spTree/p:pic/p:nvPicPr/p:nvPr/p:ph{type=pic,idx=10}' ) return placeholder, pic, spTree, expected_xml
def base_val_fixture(self, request, _base_placeholder_prop_, layout_placeholder_): has_base_placeholder, expected_value = request.param placeholder = _BaseSlidePlaceholder(None, None) if has_base_placeholder: layout_placeholder_.width = expected_value _base_placeholder_prop_.return_value = layout_placeholder_ else: _base_placeholder_prop_.return_value = None return placeholder, 'width', expected_value
def layout_val_fixture(self, request, _layout_placeholder_, layout_placeholder_): has_layout_placeholder, expected_value = request.param placeholder = _BaseSlidePlaceholder(None, None) if has_layout_placeholder: layout_placeholder_.width = expected_value _layout_placeholder_.return_value = layout_placeholder_ else: _layout_placeholder_.return_value = None return placeholder, 'width', expected_value
def it_provides_inherited_dims_when_no_override(self, request, prop_name): method_mock(request, _BaseSlidePlaceholder, "_inherited_value", return_value=42) placeholder = _BaseSlidePlaceholder(element("p:sp/p:spPr"), None) value = getattr(placeholder, prop_name) placeholder._inherited_value.assert_called_once_with( placeholder, prop_name) assert value == 42
def it_knows_its_shape_type(self): placeholder = _BaseSlidePlaceholder(None, None) assert placeholder.shape_type == MSO_SHAPE_TYPE.PLACEHOLDER
def override_fixture(self, request): prop_name, sp_cxml, value = request.param slide_placeholder = _BaseSlidePlaceholder(element(sp_cxml), None) return slide_placeholder, prop_name, value
def inherited_fixture(self, request, _inherited_value_): prop_name = request.param placeholder = _BaseSlidePlaceholder(element("p:sp/p:spPr"), None) _inherited_value_.return_value = expected_value = 42 return placeholder, prop_name, expected_value
def dim_set_fixture(self, request): sp_cxml, prop_name, value, expected_cxml = request.param placeholder = _BaseSlidePlaceholder(element(sp_cxml), None) expected_xml = xml(expected_cxml) return placeholder, prop_name, value, expected_xml
def slide_layout_fixture(self, part_prop_, slide_, slide_layout_): placeholder = _BaseSlidePlaceholder(None, None) part_prop_.return_value = slide_ slide_.slide_layout = slide_layout_ return placeholder, slide_layout_
def inherited_fixture(self, request, _inherited_value_): prop_name = request.param placeholder = _BaseSlidePlaceholder(element('p:sp/p:spPr'), None) _inherited_value_.return_value = expected_value = 42 return placeholder, prop_name, expected_value