kiva.testing module

class kiva.testing.KivaTestAssistant[source]

Bases: object

Mixin test helper for kiva drawing tests.

assertPathsAreCreated(drawable, width=200, height=200)[source]

Check that drawing creates paths.

When paths and lines creation methods are used from a graphics context the drawing paths are compiled and processed. By using a mock graphics context we can check if something has been drawn.

Parameters
  • drawable – A drawable object that has a draw method.

  • width (int, optional) – The width of the array buffer (default is 200).

  • height (int, optional) – The height of the array buffer (default is 200).

assertPathsAreProcessed(drawable, width=200, height=200)[source]

Check that all the paths have been compiled and processed.

Parameters
  • drawable – A drawable object that has a draw method.

  • width (int, optional) – The width of the array buffer (default is 200).

  • height (int, optional) – The height of the array buffer (default is 200).

  • :: (note) – A drawable that draws nothing will pass this check.

create_mock_gc(width, height, methods=())[source]

Create an image graphics context that with mocked methods.

Parameters
  • width – The size of the graphics context canvas.

  • height – The size of the graphics context canvas.

  • methods (iterable) – the methods which are going to be mocked with a Mock object.