[Numpy-discussion] actual, desired versus x, y

Keith Goodman kwgoodman at gmail.com
Thu Jun 3 13:07:01 EDT 2010


Some of the numpy.testing assert functions call the input x and y,
others call it actual and desired:

>> actual = np.array([1+1j])
>> desired = np.array([2+2j])

>> assert_almost_equal(actual, desired)
<snip>
AssertionError: Items are not equal:
ACTUAL: [ 1.+1.j]
DESIRED: [ 2.+2.j]

>> assert_almost_equal(actual.real, desired.real)
<snip>
(mismatch 100.0%)
 x: array([ 1.])
 y: array([ 2.])

I like the actual and desired, helps me remember which is which.

BTW: numpy.testing is very handy!



More information about the NumPy-Discussion mailing list