diff options
author | David Cournapeau <cournape@gmail.com> | 2008-10-05 07:00:33 +0000 |
---|---|---|
committer | David Cournapeau <cournape@gmail.com> | 2008-10-05 07:00:33 +0000 |
commit | 50d1e8edc57b51a42cd82c9ef74a8e799ed36801 (patch) | |
tree | ccaba8c6f96b3ac715d5ad56ef3b34093778d9a5 /numpy/core/tests | |
parent | 0273ac8609ab82eaa4240c437083bfeb5b707e29 (diff) | |
parent | a0e082a087e9667e3805d3be859958a292e8f336 (diff) | |
download | numpy-50d1e8edc57b51a42cd82c9ef74a8e799ed36801.tar.gz |
Merged revisions 5882-5911 via svnmerge from
http://svn.scipy.org/svn/numpy/trunk
........
r5886 | charris | 2008-10-02 03:05:29 +0900 (Thu, 02 Oct 2008) | 4 lines
Make some error messages more informative.
Improve error handling.
Make continuation lines work.
........
r5887 | charris | 2008-10-02 03:06:04 +0900 (Thu, 02 Oct 2008) | 2 lines
Small cleanup to clarify repeated string.
........
r5888 | charris | 2008-10-02 03:08:41 +0900 (Thu, 02 Oct 2008) | 6 lines
Cleanup ufunc loops.
At this point loops are separated into variable kinds, so there is a fair amount
of duplication. I will probably merge loops that look the same in a later
commit. There are no changes to current behavior of loops, this will also be
changed in later work to deal with nans and such.
........
r5889 | oliphant | 2008-10-03 05:27:17 +0900 (Fri, 03 Oct 2008) | 1 line
Fix problem with subclasses of object arrays.
........
r5896 | cdavid | 2008-10-03 15:50:32 +0900 (Fri, 03 Oct 2008) | 1 line
Update the minimum version for numscons: had to change to cope with Chuck changes to conv_template.py.
........
r5897 | cdavid | 2008-10-03 15:51:03 +0900 (Fri, 03 Oct 2008) | 1 line
Update doall script: take the python version to build binaries from the command line instead of global variable.
........
r5906 | oliphant | 2008-10-04 00:55:52 +0900 (Sat, 04 Oct 2008) | 1 line
Fix ticket #925
........
Diffstat (limited to 'numpy/core/tests')
-rw-r--r-- | numpy/core/tests/test_multiarray.py | 20 | ||||
-rw-r--r-- | numpy/core/tests/test_umath.py | 10 |
2 files changed, 30 insertions, 0 deletions
diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py index 50a02058e..ccfbe354c 100644 --- a/numpy/core/tests/test_multiarray.py +++ b/numpy/core/tests/test_multiarray.py @@ -946,6 +946,26 @@ class TestSummarization(TestCase): assert repr(A) == reprA +class TestChoose(TestCase): + def setUp(self): + self.x = 2*ones((3,),dtype=int) + self.y = 3*ones((3,),dtype=int) + self.x2 = 2*ones((2,3), dtype=int) + self.y2 = 3*ones((2,3), dtype=int) + self.ind = [0,0,1] + + def test_basic(self): + A = np.choose(self.ind, (self.x, self.y)) + assert_equal(A, [2,2,3]) + + def test_broadcast1(self): + A = np.choose(self.ind, (self.x2, self.y2)) + assert_equal(A, [[2,2,3],[2,2,3]]) + + def test_broadcast2(self): + A = np.choose(self.ind, (self.x, self.y2)) + assert_equal(A, [[2,2,3],[2,2,3]]) + if __name__ == "__main__": run_module_suite() diff --git a/numpy/core/tests/test_umath.py b/numpy/core/tests/test_umath.py index b9c2675fd..ee2893f18 100644 --- a/numpy/core/tests/test_umath.py +++ b/numpy/core/tests/test_umath.py @@ -281,6 +281,16 @@ class TestAttributes(TestCase): assert_equal(add.nout, 1) assert_equal(add.identity, 0) +class TestSubclass(TestCase): + def test_subclass_op(self): + class simple(np.ndarray): + def __new__(subtype, shape): + self = np.ndarray.__new__(subtype, shape, dtype=object) + self.fill(0) + return self + a = simple((3,4)) + assert_equal(a+a, a) + def _check_branch_cut(f, x0, dx, re_sign=1, im_sign=-1, sig_zero_ok=False, dtype=np.complex): """ |