testplan.exporters.testing.pdf.renderers.entries package

Submodules

testplan.exporters.testing.pdf.renderers.entries.assertions module

TODO

class testplan.exporters.testing.pdf.renderers.entries.assertions.ApproximateEqualityAssertionRenderer(style)[source]

Bases: testplan.exporters.testing.pdf.renderers.entries.assertions.AssertionRenderer

Assertion renderer for serialized assertion entries:
  • IsClose
get_detail(source, depth, row_idx)[source]
class testplan.exporters.testing.pdf.renderers.entries.assertions.AssertionRenderer(style)[source]

Bases: testplan.exporters.testing.pdf.renderers.entries.base.SerializedEntryRenderer

Default fallback for rendering serialized assertion entries.

get_detail(source, depth, row_idx)[source]
get_header(source, depth, row_idx)[source]

Display the description or type as the header.

get_row_data(source, depth, **kwargs)[source]

Most entries will be rendered as single rows, so we use get_row_content and get_row_style for simplicity.

class testplan.exporters.testing.pdf.renderers.entries.assertions.ColumnContainRenderer(style)[source]

Bases: testplan.exporters.testing.pdf.renderers.entries.assertions.AssertionRenderer

ColumnContain renderer for serialized assertion entries.

get_detail(source, depth, row_idx)[source]
class testplan.exporters.testing.pdf.renderers.entries.assertions.DictCheckRenderer(style)[source]

Bases: testplan.exporters.testing.pdf.renderers.entries.assertions.AssertionRenderer

FixCheck renderer for serialized assertion entries.

get_detail(source, depth, row_idx)[source]

Return has_keys & absent_keys context

class testplan.exporters.testing.pdf.renderers.entries.assertions.DictMatchAllRenderer(style)[source]

Bases: testplan.exporters.testing.pdf.renderers.entries.assertions.AssertionRenderer

FixMatchAll renderer for serialized assertion entries.

get_detail(source, depth, row_idx)[source]
class testplan.exporters.testing.pdf.renderers.entries.assertions.DictMatchRenderer(style)[source]

Bases: testplan.exporters.testing.pdf.renderers.entries.assertions.AssertionRenderer

FixMatch renderer for serialized assertion entries.

get_detail(source, depth, row_idx)[source]
class testplan.exporters.testing.pdf.renderers.entries.assertions.EqualExcludeSlicesRenderer(style)[source]

Bases: testplan.exporters.testing.pdf.renderers.entries.assertions.AssertionRenderer

EqualExcludeSlices renderer for serialized assertion entries.

get_detail(source, depth, row_idx)[source]
class testplan.exporters.testing.pdf.renderers.entries.assertions.EqualSlicesRenderer(style)[source]

Bases: testplan.exporters.testing.pdf.renderers.entries.assertions.AssertionRenderer

EqualSlices renderer for serialized assertion entries.

get_detail(source, depth, row_idx)[source]
class testplan.exporters.testing.pdf.renderers.entries.assertions.ExceptionRaisedRenderer(style)[source]

Bases: testplan.exporters.testing.pdf.renderers.entries.assertions.AssertionRenderer

ExceptionRaised renderer for serialized assertion entries.

get_detail(source, depth, row_idx)[source]
class testplan.exporters.testing.pdf.renderers.entries.assertions.FunctionAssertionRenderer(style)[source]

Bases: testplan.exporters.testing.pdf.renderers.entries.assertions.AssertionRenderer

Basic assertion renderer for serialized assertion entries:
  • Equal
  • NotEqual
  • Greater
  • GreaterEqual
  • Less
  • LessEqual
get_detail(source, depth, row_idx)[source]
class testplan.exporters.testing.pdf.renderers.entries.assertions.LineDiffRenderer(style)[source]

Bases: testplan.exporters.testing.pdf.renderers.entries.assertions.AssertionRenderer

LineDiff renderer for serialized assertion entries.

get_detail(source, depth, row_idx)[source]
class testplan.exporters.testing.pdf.renderers.entries.assertions.MembershipRenderer(style)[source]

Bases: testplan.exporters.testing.pdf.renderers.entries.assertions.AssertionRenderer

Contain & NotContain renderer for serialized assertion entries.

get_detail(source, depth, row_idx)[source]

Return the member and container representations

class testplan.exporters.testing.pdf.renderers.entries.assertions.RawAssertionRenderer(style)[source]

Bases: testplan.exporters.testing.pdf.renderers.entries.assertions.AssertionRenderer

get_detail(source, depth, row_idx)[source]
class testplan.exporters.testing.pdf.renderers.entries.assertions.RegexFindIterRenderer(style)[source]

Bases: testplan.exporters.testing.pdf.renderers.entries.assertions.RegexMatchRenderer

RegexFindIter renderer for serialized assertion entries.

get_detail(source, depth, row_idx)[source]

Render condition attribute as well, if it exists

class testplan.exporters.testing.pdf.renderers.entries.assertions.RegexMatchLineRenderer(style)[source]

Bases: testplan.exporters.testing.pdf.renderers.entries.assertions.AssertionRenderer

RegexMatchLine renderer for serialized assertion entries.

get_detail(source, depth, row_idx)[source]

RegexMatchLine returns line indexes along with begin/end character indexes per matched line.

class testplan.exporters.testing.pdf.renderers.entries.assertions.RegexMatchRenderer(style)[source]

Bases: testplan.exporters.testing.pdf.renderers.entries.assertions.AssertionRenderer

RegexMatch renderer for serialized assertion entries.

bold = False
get_detail(source, depth, row_idx)[source]

Return highlighted patterns within the string, if there is a match.

highlight_color = 'green'
class testplan.exporters.testing.pdf.renderers.entries.assertions.RegexNotMatchRenderer(style)[source]

Bases: testplan.exporters.testing.pdf.renderers.entries.assertions.RegexMatchRenderer

RegexNotMatch renderer for serialized assertion entries.

bold = True
highlight_color = 'red'
class testplan.exporters.testing.pdf.renderers.entries.assertions.TableMatchRenderer(style)[source]

Bases: testplan.exporters.testing.pdf.renderers.entries.assertions.AssertionRenderer

Renders serialized tabular data in ReportLab table format.

get_detail(source, depth, row_idx)[source]
get_matched_row_data(row_comparison, columns, include_columns, exclude_columns, row_idx)[source]

Return a single row of data in the correct match format and the RowStyles indicating which cells need to be coloured red.

Sample output:

[{‘name’: Susan == Susan, ‘age’: 24 == 24}]

and

[RowStyle(…), …]

Parameters:
  • row_comparison (testplan.testing.multitest .entries.assertions.RowComparison) – RowComparison object containing this rows data.
  • columns (list) – List of the displayed columns.
  • row_idx (int) – Index of the row being compared. This is not the same as other row_idx parameters in this module. Those refer to the row index of the global table used to display everything in the PDF report.
  • include_columns
  • exclude_columns
Returns:

A single row of the matched data in tabular format and the RowStyles indicating which cells need to be coloured red.

Return type:

list of dict and list of testplan.common.exporters.pdf.RowStyle

class testplan.exporters.testing.pdf.renderers.entries.assertions.XMLCheckRenderer(style)[source]

Bases: testplan.exporters.testing.pdf.renderers.entries.assertions.AssertionRenderer

XMLCheck renderer for serialized assertion entries.

get_detail(source, depth, row_idx)[source]

Render the message if there is any, then render XMLTagComparison items.

testplan.exporters.testing.pdf.renderers.entries.assertions.append_comparison_data(data, row, depth, start_idx)[source]

TODO.

testplan.exporters.testing.pdf.renderers.entries.assertions.default_assertion_style(depth, passed)[source]
testplan.exporters.testing.pdf.renderers.entries.assertions.html_escape(s, *, quote=False)

Replace special characters “&”, “<” and “>” to HTML-safe sequences. If the optional flag quote is true (the default), the quotation mark characters, both double quote (”) and single quote (’) characters are also translated.

testplan.exporters.testing.pdf.renderers.entries.base module

TODO

class testplan.exporters.testing.pdf.renderers.entries.base.AttachmentRenderer(style)[source]

Bases: testplan.exporters.testing.pdf.renderers.entries.base.SerializedEntryRenderer

Render an assertion of attaching file from a serialized entry.

get_row_data(source, depth, row_idx)[source]

Display path of attached file.

class testplan.exporters.testing.pdf.renderers.entries.base.DictLogRenderer(style)[source]

Bases: testplan.exporters.testing.pdf.renderers.entries.base.SerializedEntryRenderer

Render a mapping object from a serialized entry.

get_row_data(source, depth, row_idx)[source]

Reformat the rows from the serialized data into a format ReportLab accepts. Create a header and rows of flattened mapping object.

class testplan.exporters.testing.pdf.renderers.entries.base.DirectoryRenderer(style)[source]

Bases: testplan.exporters.testing.pdf.renderers.entries.base.SerializedEntryRenderer

Render an assertion of attaching directory from a serialized entry.

get_row_data(source, depth, row_idx)[source]

Display path of attached directory.

class testplan.exporters.testing.pdf.renderers.entries.base.GraphRenderer(style)[source]

Bases: testplan.exporters.testing.pdf.renderers.entries.base.SerializedEntryRenderer

get_row_data(source, depth, row_idx)[source]

Load the graph as a static image using MatPlotLib

class testplan.exporters.testing.pdf.renderers.entries.base.LogRenderer(style)[source]

Bases: testplan.exporters.testing.pdf.renderers.entries.base.SerializedEntryRenderer

get_header(source, depth, row_idx)[source]

Display the description or the log message (if no description) as the header.

get_row_data(source, depth, row_idx)[source]

Create a header and a detailed log message, only create a head if should display a string message without the description.

class testplan.exporters.testing.pdf.renderers.entries.base.MatPlotRenderer(style)[source]

Bases: testplan.exporters.testing.pdf.renderers.entries.base.SerializedEntryRenderer

Render a Matplotlib assertion from a serialized entry.

get_row_data(source, depth, row_idx)[source]

Load the Matplotlib graph from the saved image, set its height and width and add it to the row.

class testplan.exporters.testing.pdf.renderers.entries.base.PlotlyRenderer(style)[source]

Bases: testplan.exporters.testing.pdf.renderers.entries.base.SerializedEntryRenderer

Render a Plotly assertion from a serialized entry.

get_row_data(source, depth, row_idx)[source]

Most entries will be rendered as single rows, so we use get_row_content and get_row_style for simplicity.

class testplan.exporters.testing.pdf.renderers.entries.base.SerializedEntryRegistry[source]

Bases: testplan.common.utils.registry.Registry

Registry that is used for binding assertion classes to PDF renderers.

Keep in mind that we pass around serialized version of assertion objects (generated via multitest.entries.schemas) meaning that lookup arguments will be dictionary representation instead of assertion object instances, hence the need to use class names instead of class objects for data keys.

get_category(obj)[source]

Override this to define logic for generating the category key from the object instance.

get_lookup_key(obj)[source]

This method is used for generating the key when do a lookup from the registry. Object class is used by default.

get_record_key(obj)[source]

This method is used for generating the key when we bind an object (possibly a class) via the registry.

class testplan.exporters.testing.pdf.renderers.entries.base.SerializedEntryRenderer(style)[source]

Bases: testplan.exporters.testing.pdf.renderers.base.BaseRowRenderer

Default fallback for all serialized entries.

get_header(source, depth, row_idx)[source]

Display the description or type as the header.

get_row_content(source)[source]

All entries will either have a description or type, we display whatever is available.

get_row_data(source, depth, row_idx)[source]

Most entries will be rendered as single rows, so we use get_row_content and get_row_style for simplicity.

get_row_style(source, depth, **kwargs)[source]

Default styling for all serialized entries, with small font size.

get_style(source)[source]
should_display(source)[source]

Use class attribute by default.

class testplan.exporters.testing.pdf.renderers.entries.base.TableLogRenderer(style)[source]

Bases: testplan.exporters.testing.pdf.renderers.entries.base.SerializedEntryRenderer

Render a Table from a serialized entry.

get_row_data(source, depth, row_idx)[source]

Reformat the rows from the serialized data into a format ReportLab accepts. Create a header and a ReportLab table and add it to the row.

testplan.exporters.testing.pdf.renderers.entries.baseUtils module

testplan.exporters.testing.pdf.renderers.entries.baseUtils.export_plot_to_image(graph_plot)[source]

Convert a MatPlot plot into an image readable in the pdf.

testplan.exporters.testing.pdf.renderers.entries.baseUtils.format_image(image)[source]

Resize the image.

testplan.exporters.testing.pdf.renderers.entries.baseUtils.get_axis_labels(graph_options)[source]

Return the X and Y axis labels from graph options.

testplan.exporters.testing.pdf.renderers.entries.baseUtils.get_colour(series_options, series_name)[source]

Return the graph colour for the series specified.

testplan.exporters.testing.pdf.renderers.entries.baseUtils.get_matlib_plot(source)[source]

Call the appropriate plotting function based on whether a graph or chart is being plotted.

testplan.exporters.testing.pdf.renderers.entries.baseUtils.get_xy_coords(data)[source]

Return two lists of x and y coordinates from graph data formatted for react-vis graphing (‘x’: Data, ‘y’: Data).

testplan.exporters.testing.pdf.renderers.entries.baseUtils.plot_chart(source, graph_type)[source]

Create a MatPlot plot for any chart not requiring axes.

testplan.exporters.testing.pdf.renderers.entries.baseUtils.plot_graph(source, graph_type)[source]

Create a MatPlot plot for any graph requiring axis (and can therefore use the get_xy_coords function.)

testplan.exporters.testing.pdf.renderers.entries.baseUtils.show_legend(graph_options)[source]

Return true if the legend should be displayed.

Module contents

Need to load these so registry bindings trigger

testplan.exporters.testing.pdf.renderers.entries.html_escape(s, *, quote=False)

Replace special characters “&”, “<” and “>” to HTML-safe sequences. If the optional flag quote is true (the default), the quotation mark characters, both double quote (”) and single quote (’) characters are also translated.