Throughout the process of developing the functionality outlined in #2 and #3 we need to be using test driven development to test the modules we are creating.
An example of which is the following code which tests the assert_matrix_equals(x, y, delta) function.
def test_assert_matrix_equals():
dims = randrange(1, 100), randrange(1, 100)
A = np.random.random_sample(dims)
B = A - randrange(1, 500)
try:
assert_matrix_equals(A, B)
except:
pass # test passed, assert_matrix should through exception
else:
raise AssertionError("assert_matrix_equals claims two unequal matrices are equal")
The first three lines create the random test data A and B, B is a different matrix to A as each value has something greater than 1 subtracted from it. As A and B are not equal assert_matrix_equals should throw an exception, which it does hence test passed.
Throughout the process of developing the functionality outlined in #2 and #3 we need to be using test driven development to test the modules we are creating.
An example of which is the following code which tests the assert_matrix_equals(x, y, delta) function.
The first three lines create the random test data A and B, B is a different matrix to A as each value has something greater than 1 subtracted from it. As A and B are not equal assert_matrix_equals should throw an exception, which it does hence test passed.