tbplas.TestHelper

class tbplas.TestHelper(tester: TestCase)

Helper class that makes unittest easier.

_tester

testcase upon which tests are performed

Type:

‘unittest.TestCase’ instance

__init__(tester: TestCase) None
Parameters:

tester – testcase upon which tests are performed

Methods

__init__(tester)

test_equal_array(array1, array2[, almost, delta])

Checks if two arrays are equal to each other.

test_no_equal_array(array1, array2[, ...])

Checks if two arrays are not equal to each other.

test_no_raise(func, exception)

Tests if expected exception is not raised during an operation.

test_raise(func, exception, message)

Tests if expected exception is raised during an operation.

test_stdout(func, message)

Test if the output contain given message. :param func: wrapper function over the operation to test :param message: reference message with which to compare, each regex corresponds to one line of output :return: None.

__init__(tester: TestCase) None
Parameters:

tester – testcase upon which tests are performed

test_equal_array(array1: ndarray, array2: ndarray, almost: bool = False, delta: float = 1e-07) None

Checks if two arrays are equal to each other. :param array1: 1st array to compare :param array2: 2nd array to compare :param almost: whether to compare according to difference :param delta: threshold for difference :return: None.

test_no_equal_array(array1: ndarray, array2: ndarray, almost: bool = False, delta: float = 1e-07) None

Checks if two arrays are not equal to each other. :param array1: 1st array to compare :param array2: 2nd array to compare :param almost: whether to compare according to difference :param delta: threshold for difference :return: None.

test_no_raise(func: Callable, exception: Any) None

Tests if expected exception is not raised during an operation. :param func: wrapper function over the operation to test :param exception: category of exception to test :return: None

test_raise(func: Callable, exception: Any, message: str) None

Tests if expected exception is raised during an operation. :param func: wrapper function over the operation to test :param exception: category of exception to test :param message: expected exception message :return: None

test_stdout(func: Callable, message: List[str]) None

Test if the output contain given message. :param func: wrapper function over the operation to test :param message: reference message with which to compare, each regex

corresponds to one line of output

Returns:

None

__weakref__

list of weak references to the object