Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/mingw32/Python27/Lib/site-packages/numpy/matrixlib/tests/test_multiarray.py @ 87:2a2c65a20a8b
Add Python libs and headers
author | Chris Cannam |
---|---|
date | Wed, 25 Feb 2015 14:05:22 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
86:413a9d26189e | 87:2a2c65a20a8b |
---|---|
1 from __future__ import division, absolute_import, print_function | |
2 | |
3 import numpy as np | |
4 from numpy.testing import * | |
5 | |
6 class TestView(TestCase): | |
7 def test_type(self): | |
8 x = np.array([1, 2, 3]) | |
9 assert_(isinstance(x.view(np.matrix), np.matrix)) | |
10 | |
11 def test_keywords(self): | |
12 x = np.array([(1, 2)], dtype=[('a', np.int8), ('b', np.int8)]) | |
13 # We must be specific about the endianness here: | |
14 y = x.view(dtype='<i2', type=np.matrix) | |
15 assert_array_equal(y, [[513]]) | |
16 | |
17 assert_(isinstance(y, np.matrix)) | |
18 assert_equal(y.dtype, np.dtype('<i2')) |