/usr/lib64/python2.6/site-packages/numpy/core/tests
NameSizeModeActions
data/-0755rm
test_blasdot.py4650644editdlrm
test_blasdot.pyc9900644editdlrm
test_blasdot.pyo9900644editdlrm
test_defchararray.py235830644editdlrm
test_defchararray.pyc368470644editdlrm
test_defchararray.pyo323920644editdlrm
test_dtype.py39870644editdlrm
test_dtype.pyc65460644editdlrm
test_dtype.pyo65460644editdlrm
test_errstate.py17120644editdlrm
test_errstate.pyc16540644editdlrm
test_errstate.pyo16540644editdlrm
test_function_base.py9840644editdlrm
test_function_base.pyc23190644editdlrm
test_function_base.pyo20170644editdlrm
test_getlimits.py16300644editdlrm
test_getlimits.pyc37990644editdlrm
test_getlimits.pyo37990644editdlrm
test_machar.py10000644editdlrm
test_machar.pyc17050644editdlrm
test_machar.pyo17050644editdlrm
test_memmap.py21010644editdlrm
test_memmap.pyc33410644editdlrm
test_memmap.pyo32890644editdlrm
test_multiarray.py518580644editdlrm
test_multiarray.pyc702540644editdlrm
test_multiarray.pyo696390644editdlrm
test_numeric.py307730644editdlrm
test_numeric.pyc480280644editdlrm
test_numeric.pyo459700644editdlrm
test_numerictypes.py141940644editdlrm
test_numerictypes.pyc179080644editdlrm
test_numerictypes.pyo175720644editdlrm
test_print.py80910644editdlrm
test_print.pyc92240644editdlrm
test_print.pyo92240644editdlrm
test_records.py53250644editdlrm
test_records.pyc91830644editdlrm
test_records.pyo85340644editdlrm
test_regression.py430970644editdlrm
test_regression.pyc670250644editdlrm
test_regression.pyo625030644editdlrm
test_scalarmath.py37890644editdlrm
test_scalarmath.pyc53950644editdlrm
test_scalarmath.pyo50960644editdlrm
test_shape_base.py45710644editdlrm
test_shape_base.pyc88900644editdlrm
test_shape_base.pyo83260644editdlrm
test_ufunc.py169440644editdlrm
test_ufunc.pyc183660644editdlrm
test_ufunc.pyo181350644editdlrm
test_umath.py359910644editdlrm
test_umath.pyc547650644editdlrm
test_umath.pyo513770644editdlrm
test_umath_complex.py177280644editdlrm
test_umath_complex.pyc168860644editdlrm
test_umath_complex.pyo168860644editdlrm
test_unicode.py112550644editdlrm
test_unicode.pyc150700644editdlrm
test_unicode.pyo150700644editdlrm
Edit: /usr/lib64/python2.6/site-packages/numpy/core/tests/test_records.py (5325B)
from os import path import numpy as np from numpy.testing import * class TestFromrecords(TestCase): def test_fromrecords(self): r = np.rec.fromrecords([[456, 'dbe', 1.2], [2, 'de', 1.3]], names='col1,col2,col3') assert_equal(r[0].item(), (456, 'dbe', 1.2)) def test_method_array(self): r = np.rec.array('abcdefg' * 100, formats='i2,a3,i4', shape=3, byteorder='big') assert_equal(r[1].item(), (25444, 'efg', 1633837924)) def test_method_array2(self): r = np.rec.array([(1, 11, 'a'), (2, 22, 'b'), (3, 33, 'c'), (4, 44, 'd'), (5, 55, 'ex'), (6, 66, 'f'), (7, 77, 'g')], formats='u1,f4,a1') assert_equal(r[1].item(), (2, 22.0, 'b')) def test_recarray_slices(self): r = np.rec.array([(1, 11, 'a'), (2, 22, 'b'), (3, 33, 'c'), (4, 44, 'd'), (5, 55, 'ex'), (6, 66, 'f'), (7, 77, 'g')], formats='u1,f4,a1') assert_equal(r[1::2][1].item(), (4, 44.0, 'd')) def test_recarray_fromarrays(self): x1 = np.array([1, 2, 3, 4]) x2 = np.array(['a', 'dd', 'xyz', '12']) x3 = np.array([1.1, 2, 3, 4]) r = np.rec.fromarrays([x1, x2, x3], names='a,b,c') assert_equal(r[1].item(), (2, 'dd', 2.0)) x1[1] = 34 assert_equal(r.a, np.array([1, 2, 3, 4])) def test_recarray_fromfile(self): data_dir = path.join(path.dirname(__file__), 'data') filename = path.join(data_dir, 'recarray_from_file.fits') fd = open(filename) fd.seek(2880 * 2) r = np.rec.fromfile(fd, formats='f8,i4,a5', shape=3, byteorder='big') def test_recarray_from_obj(self): count = 10 a = np.zeros(count, dtype='O') b = np.zeros(count, dtype='f8') c = np.zeros(count, dtype='f8') for i in range(len(a)): a[i] = range(1, 10) mine = np.rec.fromarrays([a, b, c], names='date,data1,data2') for i in range(len(a)): assert (mine.date[i] == range(1, 10)) assert (mine.data1[i] == 0.0) assert (mine.data2[i] == 0.0) def test_recarray_from_repr(self): x = np.rec.array([ (1, 2)], dtype=[('a', np.int8), ('b', np.int8)]) y = eval("np." + repr(x)) assert isinstance(y, np.recarray) assert_equal(y, x) def test_recarray_from_names(self): ra = np.rec.array([ (1, 'abc', 3.7000002861022949, 0), (2, 'xy', 6.6999998092651367, 1), (0, ' ', 0.40000000596046448, 0)], names='c1, c2, c3, c4') pa = np.rec.fromrecords([ (1, 'abc', 3.7000002861022949, 0), (2, 'xy', 6.6999998092651367, 1), (0, ' ', 0.40000000596046448, 0)], names='c1, c2, c3, c4') assert ra.dtype == pa.dtype assert ra.shape == pa.shape for k in xrange(len(ra)): assert ra[k].item() == pa[k].item() def test_recarray_conflict_fields(self): ra = np.rec.array([(1, 'abc', 2.3), (2, 'xyz', 4.2), (3, 'wrs', 1.3)], names='field, shape, mean') ra.mean = [1.1, 2.2, 3.3] assert_array_almost_equal(ra['mean'], [1.1, 2.2, 3.3]) assert type(ra.mean) is type(ra.var) ra.shape = (1, 3) assert ra.shape == (1, 3) ra.shape = ['A', 'B', 'C'] assert_array_equal(ra['shape'], [['A', 'B', 'C']]) ra.field = 5 assert_array_equal(ra['field'], [[5, 5, 5]]) assert callable(ra.field) def test_fromrecords_with_explicit_dtype(self): a = np.rec.fromrecords([(1, 'a'), (2, 'bbb')], dtype=[('a', int), ('b', np.object)]) assert_equal(a.a, [1, 2]) assert_equal(a[0].a, 1) assert_equal(a.b, ['a', 'bbb']) assert_equal(a[-1].b, 'bbb') # ndtype = np.dtype([('a', int), ('b', np.object)]) a = np.rec.fromrecords([(1, 'a'), (2, 'bbb')], dtype=ndtype) assert_equal(a.a, [1, 2]) assert_equal(a[0].a, 1) assert_equal(a.b, ['a', 'bbb']) assert_equal(a[-1].b, 'bbb') class TestRecord(TestCase): def setUp(self): self.data = np.rec.fromrecords([(1, 2, 3), (4, 5, 6)], dtype=[("col1", "