def replace_fixture(self, chart_data_, SeriesXmlRewriterFactory_, series_rewriter_, workbook_, workbook_prop_): chartSpace = element('c:chartSpace/c:chart/c:plotArea/c:pieChart') chart = Chart(chartSpace, None) chart_type = XL_CHART_TYPE.PIE xlsx_blob = 'fooblob' chart_data_.xlsx_blob = xlsx_blob return (chart, chart_data_, SeriesXmlRewriterFactory_, chart_type, series_rewriter_, chartSpace, workbook_, xlsx_blob)
def legend_fixture(self, request, Legend_, legend_): chartSpace_cxml, has_legend = request.param chartSpace = element(chartSpace_cxml) chart = Chart(chartSpace, None) expected_value, expected_calls = None, [] if has_legend: expected_value = legend_ legend_elm = chartSpace.chart.legend expected_calls.append(call(legend_elm)) return chart, Legend_, expected_calls, expected_value
def it_provides_access_to_its_font(self, font_fixture, Font_, font_): chartSpace, expected_xml = font_fixture Font_.return_value = font_ chart = Chart(chartSpace, None) font = chart.font assert chartSpace.xml == expected_xml Font_.assert_called_once_with( chartSpace.xpath("./c:txPr/a:p/a:pPr/a:defRPr")[0]) assert font is font_
def category_axis_fixture(self, request, CategoryAxis_, DateAxis_, ValueAxis_): ax_tag = request.param chartSpace_cxml = "c:chartSpace/c:chart/c:plotArea/%s" % ax_tag chartSpace = element(chartSpace_cxml) chart = Chart(chartSpace, None) AxisCls_ = { "c:catAx": CategoryAxis_, "c:dateAx": DateAxis_, "c:valAx": ValueAxis_, }[ax_tag] axis_ = AxisCls_.return_value xAx = chartSpace.xpath(".//%s" % ax_tag)[0] return chart, axis_, AxisCls_, xAx
def title_fixture(self, request, ChartTitle_, chart_title_): chartSpace_cxml, expected_cxml = request.param chart = Chart(element(chartSpace_cxml), None) expected_xml = xml(expected_cxml) return chart, expected_xml, ChartTitle_, chart_title_
def style_get_fixture(self, request): chartSpace_cxml, expected_value = request.param chart = Chart(element(chartSpace_cxml), None) return chart, expected_value
def style_set_fixture(self, request): chartSpace_cxml, new_value, expected_chartSpace_cxml = request.param chart = Chart(element(chartSpace_cxml), None) expected_xml = xml(expected_chartSpace_cxml) return chart, new_value, expected_xml
def plots_fixture(self, _Plots_, plots_): chartSpace = element("c:chartSpace/c:chart/c:plotArea") plotArea = chartSpace.xpath("./c:chart/c:plotArea")[0] chart = Chart(chartSpace, None) return chart, plots_, _Plots_, plotArea
def series_fixture(self, SeriesCollection_, series_collection_): chartSpace = element("c:chartSpace/c:chart/c:plotArea") plotArea = chartSpace.xpath(".//c:plotArea")[0] chart = Chart(chartSpace, None) return chart, SeriesCollection_, plotArea, series_collection_
def chart_type_fixture(self, PlotTypeInspector_, plot_, chart_type_): chart = Chart(None, None) chart._plots = [plot_] return chart, PlotTypeInspector_, plot_, chart_type_
def chart(self): """|Chart| object representing the chart in this part.""" return Chart(self._element, self)
def series_fixture(self, SeriesCollection_, series_collection_): chartSpace = element('c:chartSpace') chart = Chart(chartSpace, None) return chart, SeriesCollection_, chartSpace, series_collection_
def chart_type_fixture(self, PlotTypeInspector_, plot_): chart = Chart(None, None) chart._plots = [plot_] chart_type = XL_CHART_TYPE.PIE PlotTypeInspector_.chart_type.return_value = chart_type return chart, PlotTypeInspector_, plot_, chart_type
def cat_ax_raise_fixture(self): chart = Chart(element('c:chartSpace/c:chart/c:plotArea'), None) return chart
def val_ax_fixture(self, ValueAxis_, value_axis_): chartSpace = element('c:chartSpace/c:chart/c:plotArea/c:valAx') valAx = chartSpace.xpath('./c:chart/c:plotArea/c:valAx')[0] chart = Chart(chartSpace, None) return chart, value_axis_, ValueAxis_, valAx
def series_fixture(self, SeriesCollection_, chartSpace_, series_collection_): chart = Chart(chartSpace_, None) return chart, SeriesCollection_, chartSpace_, series_collection_
def replace_data_fixture(self, chartSpace_, chart_part_, chart_data_, _SeriesRewriter_): chart = Chart(chartSpace_, chart_part_) workbook_ = chart_part_.chart_workbook return (chart, chart_data_, _SeriesRewriter_, chartSpace_, workbook_)
def val_ax_fixture(self, request, ValueAxis_, value_axis_): chartSpace_xml, idx = request.param chartSpace = element(chartSpace_xml) chart = Chart(chartSpace, None) valAx = chartSpace.xpath(".//c:valAx")[idx] return chart, ValueAxis_, valAx, value_axis_
def has_title_set_fixture(self, request): chart_cxml, new_value, expected_cxml = request.param chart = Chart(element("c:chartSpace/%s" % chart_cxml), None) expected_xml = xml(expected_cxml) return chart, new_value, expected_xml
def val_ax_raise_fixture(self): chart = Chart(element("c:chartSpace/c:chart/c:plotArea"), None) return chart
def cat_ax_fixture(self, CategoryAxis_, category_axis_): chartSpace = element('c:chartSpace/c:chart/c:plotArea/c:catAx') catAx = chartSpace.xpath('./c:chart/c:plotArea/c:catAx')[0] chart = Chart(chartSpace, None) return chart, category_axis_, CategoryAxis_, catAx