Testing

apetype tests Module Defines TestTask that allows running a full test on a TaskBase derived class. To run the test, create a class that inherits first from TestTask and then from the Task class to be tested. Initiate and run.

The tests Module further defines all the tests for testing apetype itself.

Example: >>> from apetype.tests import TestTask, TaskBase … import numpy as np … class Task(TaskBase): … a: int = 5 … b: int = 3 … … def ar(_, a, b) -> np.ndarray: … return np.array([a,2,3])+b … def aplus10(_, ar) -> np.ndarray: … return ar+10 … def amaal10(_, ar, aplus10) -> np.ndarray: … return ar*aplus10 … class TestCase(TestTask, Task): … a = 1 … b = 1 … ar = np.array([3,3,4]) … aplus10 = np.array([3,3,4]) … amaal10 = np.array([3,3,4]) … testcase = TestCase() … testcase.run_test()

class apetype.tests.ExampleTask(parse=False, prefix=True, run=False)
class apetype.tests.ExampleTestCase(*args, TaskClass=None, **kwargs)
class apetype.tests.TestTask(*args, TaskClass=None, **kwargs)

Provide the TaskBase class to be tested either by creating a new class that first inherits from TestTask and then from the TaskBase, or initiate a TestTask instance passing the TaskBase class as an argument

Args:
TaskClass (None|TaskBase): class to be tested.
setUp()

Hook method for setting up the test fixture before exercising it.