Submit
Path:
~
/
/
proc
/
thread-self
/
root
/
opt
/
alt
/
python27
/
lib64
/
python2.7
/
site-packages
/
numpy
/
lib
/
tests
/
File Content:
test_ufunclike.py
from __future__ import division, absolute_import, print_function import numpy.core as nx import numpy.lib.ufunclike as ufl from numpy.testing import ( run_module_suite, TestCase, assert_, assert_equal, assert_array_equal ) class TestUfunclike(TestCase): def test_isposinf(self): a = nx.array([nx.inf, -nx.inf, nx.nan, 0.0, 3.0, -3.0]) out = nx.zeros(a.shape, bool) tgt = nx.array([True, False, False, False, False, False]) res = ufl.isposinf(a) assert_equal(res, tgt) res = ufl.isposinf(a, out) assert_equal(res, tgt) assert_equal(out, tgt) def test_isneginf(self): a = nx.array([nx.inf, -nx.inf, nx.nan, 0.0, 3.0, -3.0]) out = nx.zeros(a.shape, bool) tgt = nx.array([False, True, False, False, False, False]) res = ufl.isneginf(a) assert_equal(res, tgt) res = ufl.isneginf(a, out) assert_equal(res, tgt) assert_equal(out, tgt) def test_fix(self): a = nx.array([[1.0, 1.1, 1.5, 1.8], [-1.0, -1.1, -1.5, -1.8]]) out = nx.zeros(a.shape, float) tgt = nx.array([[1., 1., 1., 1.], [-1., -1., -1., -1.]]) res = ufl.fix(a) assert_equal(res, tgt) res = ufl.fix(a, out) assert_equal(res, tgt) assert_equal(out, tgt) assert_equal(ufl.fix(3.14), 3) def test_fix_with_subclass(self): class MyArray(nx.ndarray): def __new__(cls, data, metadata=None): res = nx.array(data, copy=True).view(cls) res.metadata = metadata return res def __array_wrap__(self, obj, context=None): obj.metadata = self.metadata return obj a = nx.array([1.1, -1.1]) m = MyArray(a, metadata='foo') f = ufl.fix(m) assert_array_equal(f, nx.array([1, -1])) assert_(isinstance(f, MyArray)) assert_equal(f.metadata, 'foo') if __name__ == "__main__": run_module_suite()
Edit
Rename
Chmod
Delete
FILE
FOLDER
Name
Size
Permission
Action
data
---
0755
test__datasource.py
10445 bytes
0644
test__datasource.pyc
17373 bytes
0644
test__datasource.pyo
17373 bytes
0644
test__iotools.py
14018 bytes
0644
test__iotools.pyc
15415 bytes
0644
test__iotools.pyo
15415 bytes
0644
test__version.py
2125 bytes
0644
test__version.pyc
3588 bytes
0644
test__version.pyo
3588 bytes
0644
test_arraypad.py
42647 bytes
0644
test_arraypad.pyc
59406 bytes
0644
test_arraypad.pyo
59406 bytes
0644
test_arraysetops.py
10084 bytes
0644
test_arraysetops.pyc
10269 bytes
0644
test_arraysetops.pyo
10269 bytes
0644
test_arrayterator.py
1455 bytes
0644
test_arrayterator.pyc
2119 bytes
0644
test_arrayterator.pyo
2119 bytes
0644
test_financial.py
6607 bytes
0644
test_financial.pyc
7518 bytes
0644
test_financial.pyo
7518 bytes
0644
test_format.py
34230 bytes
0644
test_format.pyc
17334 bytes
0644
test_format.pyo
17334 bytes
0644
test_function_base.py
109003 bytes
0644
test_function_base.pyc
136810 bytes
0644
test_function_base.pyo
136810 bytes
0644
test_index_tricks.py
11462 bytes
0644
test_index_tricks.pyc
15671 bytes
0644
test_index_tricks.pyo
15671 bytes
0644
test_io.py
72111 bytes
0644
test_io.pyc
85752 bytes
0644
test_io.pyo
85752 bytes
0644
test_nanfunctions.py
28230 bytes
0644
test_nanfunctions.pyc
33706 bytes
0644
test_nanfunctions.pyo
33706 bytes
0644
test_packbits.py
951 bytes
0644
test_packbits.pyc
1529 bytes
0644
test_packbits.pyo
1529 bytes
0644
test_polynomial.py
5092 bytes
0644
test_polynomial.pyc
5581 bytes
0644
test_polynomial.pyo
5581 bytes
0644
test_recfunctions.py
30630 bytes
0644
test_recfunctions.pyc
37164 bytes
0644
test_recfunctions.pyo
37164 bytes
0644
test_regression.py
8829 bytes
0644
test_regression.pyc
14182 bytes
0644
test_regression.pyo
14182 bytes
0644
test_shape_base.py
12714 bytes
0644
test_shape_base.pyc
19247 bytes
0644
test_shape_base.pyo
19247 bytes
0644
test_stride_tricks.py
14199 bytes
0644
test_stride_tricks.pyc
16602 bytes
0644
test_stride_tricks.pyo
16602 bytes
0644
test_twodim_base.py
17996 bytes
0644
test_twodim_base.pyc
22472 bytes
0644
test_twodim_base.pyo
22472 bytes
0644
test_type_check.py
10247 bytes
0644
test_type_check.pyc
20646 bytes
0644
test_type_check.pyo
20646 bytes
0644
test_ufunclike.py
2024 bytes
0644
test_ufunclike.pyc
3633 bytes
0644
test_ufunclike.pyo
3633 bytes
0644
test_utils.py
1466 bytes
0644
test_utils.pyc
3279 bytes
0644
test_utils.pyo
3279 bytes
0644
N4ST4R_ID | Naxtarrr