test_report
– Classes modelling a test report
This module contains a simple class that models a test report. A report consists of a number of sections, and each section contains: * a title; * some optional introductory text; * optionally, other test reports and some test results.
This module also contains a task that creates a report from a list of test-evaluation tasks.
- class valjean.javert.test_report.TestReport(*, title, text='', content=None)[source]
This class models a test report. It is essentially a rose tree (i.e. a tree with an arbitrary number of children at each node) with nodes annotated with a title and some introductory text.
TestResult
objects play the role of tree leaves.- __init__(*, title, text='', content=None)[source]
Create a report.
- Parameters:
title (str) – the report title.
text (str) – some introductory text.
content (list(TestReport or TestResult)) – a list of
TestReport
orTestResult
objects.
- class valjean.javert.test_report.TestReportTask(name, *, make_report, eval_tasks, kwargs=None)[source]
Task class that creates a
TestReport
from a function that classifies test results into report sections.- __init__(name, *, make_report, eval_tasks, kwargs=None)[source]
Instantiate a
TestReportTask
from a list ofEvalTestTask
objects. The make_report argument is expected to be a function taking one argument, which is a dictionary associating the names of the tasks in eval_tasks to the results of their execution (in the sense of the'result'
key of the associated environment section). For tasks that evaluate tests (EvalTestTask
), the result typically consists of a list ofTestResult
objects. The make_report function must return aTestReport
object.- Parameters:
name (str) – the name of this task.
make_report – a function taking a single argument and returning a
TestReport
.eval_tasks (list(Task)) – a list of tasks, typically
EvalTestTask
.kwargs (dict or None) – a dictionary of kwargs that will be passed to the make_report function.