annotate DEPENDENCIES/mingw32/Python27/Lib/site-packages/numpy/matrixlib/tests/test_multiarray.py @ 133:4acb5d8d80b6
tip
Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author |
Chris Cannam |
date |
Tue, 30 Jul 2019 12:25:44 +0100 |
parents |
2a2c65a20a8b |
children |
|
rev |
line source |
Chris@87
|
1 from __future__ import division, absolute_import, print_function
|
Chris@87
|
2
|
Chris@87
|
3 import numpy as np
|
Chris@87
|
4 from numpy.testing import *
|
Chris@87
|
5
|
Chris@87
|
6 class TestView(TestCase):
|
Chris@87
|
7 def test_type(self):
|
Chris@87
|
8 x = np.array([1, 2, 3])
|
Chris@87
|
9 assert_(isinstance(x.view(np.matrix), np.matrix))
|
Chris@87
|
10
|
Chris@87
|
11 def test_keywords(self):
|
Chris@87
|
12 x = np.array([(1, 2)], dtype=[('a', np.int8), ('b', np.int8)])
|
Chris@87
|
13 # We must be specific about the endianness here:
|
Chris@87
|
14 y = x.view(dtype='<i2', type=np.matrix)
|
Chris@87
|
15 assert_array_equal(y, [[513]])
|
Chris@87
|
16
|
Chris@87
|
17 assert_(isinstance(y, np.matrix))
|
Chris@87
|
18 assert_equal(y.dtype, np.dtype('<i2'))
|