Skip to content

Adds TestSuite(object).run() generic testing framework #6343

@nthiery

Description

@nthiery

This patch implements TestSuite(object).run() which runs
systematic checks on the object. Here is a typical call:

     sage: TestSuite(ZZ).run(verbose = True)
     running ._test_an_element() ... done
     running ._test_element_pickling() ... done
     running ._test_not_implemented_methods() ... done
     running ._test_pickling() ... done

In practice, TestSuite(o).run() runs all the methods named test* of the object o.
The test* methods are typically implemented by abstract super classes
and in particular via categories, in order to enforce standard
behavior and API (_test_pickling, _test_an_element), or provide
mathematical sanity checks (_test_associativity).

For consistent error reporting, the test* methods in turn must use
the new gadget sage.misc.sage_unittest.InstanceTester to actually
run the tests.

This is used by the category patches #5891 and followers

CC: @sagetrac-sage-combinat @sagetrac-cwitty @roed314 @saliola @sagetrac-mvngu

Component: doctest coverage

Keywords: testunit

Author: Nicolas M. Thiéry

Reviewer: Mike Hansen, Minh Van Nguyen

Merged: Sage 4.1.2.alpha2

Issue created by migration from https://trac.sagemath.org/ticket/6343

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions