1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
# Authors: Emmanuelle Gouillart <emmanuelle.gouillart@normalesup.org>
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# License: BSD
import numpy as np
from nose.tools import assert_equal
from numpy.testing import assert_array_equal
from ..fixes import _in1d, _copysign
def test_in1d():
a = np.arange(10)
b = a[a % 2 == 0]
assert_equal(_in1d(a, b).sum(), 5)
def test_copysign():
a = np.array([-1, 1, -1])
b = np.array([1, -1, 1])
assert_array_equal(_copysign(a, b), b)
assert_array_equal(_copysign(b, a), a)
|