Hackfut Security File Manager
Current Path:
/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/tests
opt
/
alt
/
python27
/
lib64
/
python2.7
/
site-packages
/
numpy
/
core
/
tests
/
📁
..
📁
data
📄
test_abc.py
(1.97 KB)
📄
test_abc.pyc
(2.69 KB)
📄
test_abc.pyo
(2.69 KB)
📄
test_api.py
(18.41 KB)
📄
test_api.pyc
(15.56 KB)
📄
test_api.pyo
(15.56 KB)
📄
test_arrayprint.py
(6.73 KB)
📄
test_arrayprint.pyc
(10.33 KB)
📄
test_arrayprint.pyo
(10.33 KB)
📄
test_datetime.py
(88.29 KB)
📄
test_datetime.pyc
(60.87 KB)
📄
test_datetime.pyo
(60.87 KB)
📄
test_defchararray.py
(26.28 KB)
📄
test_defchararray.pyc
(39.08 KB)
📄
test_defchararray.pyo
(39.08 KB)
📄
test_deprecations.py
(32.64 KB)
📄
test_deprecations.pyc
(47.97 KB)
📄
test_deprecations.pyo
(47.97 KB)
📄
test_dtype.py
(24.01 KB)
📄
test_dtype.pyc
(26.9 KB)
📄
test_dtype.pyo
(26.9 KB)
📄
test_einsum.py
(25.09 KB)
📄
test_einsum.pyc
(20.42 KB)
📄
test_einsum.pyo
(20.42 KB)
📄
test_errstate.py
(1.55 KB)
📄
test_errstate.pyc
(2.4 KB)
📄
test_errstate.pyo
(2.4 KB)
📄
test_extint128.py
(5.62 KB)
📄
test_extint128.pyc
(7.75 KB)
📄
test_extint128.pyo
(7.75 KB)
📄
test_function_base.py
(5.24 KB)
📄
test_function_base.pyc
(9.45 KB)
📄
test_function_base.pyo
(9.37 KB)
📄
test_getlimits.py
(2.22 KB)
📄
test_getlimits.pyc
(5.31 KB)
📄
test_getlimits.pyo
(5.31 KB)
📄
test_half.py
(18.1 KB)
📄
test_half.pyc
(18.32 KB)
📄
test_half.pyo
(18.32 KB)
📄
test_indexerrors.py
(4.82 KB)
📄
test_indexerrors.pyc
(11.62 KB)
📄
test_indexerrors.pyo
(11.62 KB)
📄
test_indexing.py
(39.93 KB)
📄
test_indexing.pyc
(36.73 KB)
📄
test_indexing.pyo
(36.73 KB)
📄
test_item_selection.py
(3.5 KB)
📄
test_item_selection.pyc
(4.38 KB)
📄
test_item_selection.pyo
(4.38 KB)
📄
test_longdouble.py
(5.71 KB)
📄
test_longdouble.pyc
(10.27 KB)
📄
test_longdouble.pyo
(10.27 KB)
📄
test_machar.py
(1014 B)
📄
test_machar.pyc
(1.71 KB)
📄
test_machar.pyo
(1.71 KB)
📄
test_mem_overlap.py
(15.4 KB)
📄
test_mem_overlap.pyc
(21.25 KB)
📄
test_mem_overlap.pyo
(21.25 KB)
📄
test_memmap.py
(4.2 KB)
📄
test_memmap.pyc
(6.35 KB)
📄
test_memmap.pyo
(6.35 KB)
📄
test_multiarray.py
(235.11 KB)
📄
test_multiarray.pyc
(271.28 KB)
📄
test_multiarray.pyo
(271.25 KB)
📄
test_nditer.py
(101.78 KB)
📄
test_nditer.pyc
(85.59 KB)
📄
test_nditer.pyo
(85.59 KB)
📄
test_numeric.py
(89.25 KB)
📄
test_numeric.pyc
(110.54 KB)
📄
test_numeric.pyo
(110.54 KB)
📄
test_numerictypes.py
(14.38 KB)
📄
test_numerictypes.pyc
(18.27 KB)
📄
test_numerictypes.pyo
(18.27 KB)
📄
test_print.py
(8 KB)
📄
test_print.pyc
(10.02 KB)
📄
test_print.pyo
(10.02 KB)
📄
test_records.py
(13.12 KB)
📄
test_records.pyc
(17.07 KB)
📄
test_records.pyo
(17.07 KB)
📄
test_regression.py
(77.01 KB)
📄
test_regression.pyc
(106.12 KB)
📄
test_regression.pyo
(106.12 KB)
📄
test_scalarinherit.py
(771 B)
📄
test_scalarinherit.pyc
(2.72 KB)
📄
test_scalarinherit.pyo
(2.72 KB)
📄
test_scalarmath.py
(18.65 KB)
📄
test_scalarmath.pyc
(20.1 KB)
📄
test_scalarmath.pyo
(20.1 KB)
📄
test_scalarprint.py
(917 B)
📄
test_scalarprint.pyc
(1.45 KB)
📄
test_scalarprint.pyo
(1.45 KB)
📄
test_shape_base.py
(11.23 KB)
📄
test_shape_base.pyc
(14.63 KB)
📄
test_shape_base.pyo
(14.63 KB)
📄
test_ufunc.py
(49.29 KB)
📄
test_ufunc.pyc
(50.63 KB)
📄
test_ufunc.pyo
(50.63 KB)
📄
test_umath.py
(73.33 KB)
📄
test_umath.pyc
(95.78 KB)
📄
test_umath.pyo
(95.72 KB)
📄
test_umath_complex.py
(19.34 KB)
📄
test_umath_complex.pyc
(19.11 KB)
📄
test_umath_complex.pyo
(19.11 KB)
📄
test_unicode.py
(12.34 KB)
📄
test_unicode.pyc
(16.09 KB)
📄
test_unicode.pyo
(16.09 KB)
Editing: test_longdouble.py
from __future__ import division, absolute_import, print_function import locale import numpy as np from numpy.testing import ( run_module_suite, assert_, assert_equal, dec, assert_raises, assert_array_equal, TestCase, temppath, ) from numpy.compat import sixu from test_print import in_foreign_locale longdouble_longer_than_double = (np.finfo(np.longdouble).eps < np.finfo(np.double).eps) _o = 1 + np.finfo(np.longdouble).eps string_to_longdouble_inaccurate = (_o != np.longdouble(repr(_o))) del _o def test_scalar_extraction(): """Confirm that extracting a value doesn't convert to python float""" o = 1 + np.finfo(np.longdouble).eps a = np.array([o, o, o]) assert_equal(a[1], o) # Conversions string -> long double def test_repr_roundtrip(): o = 1 + np.finfo(np.longdouble).eps assert_equal(np.longdouble(repr(o)), o, "repr was %s" % repr(o)) def test_unicode(): np.longdouble(sixu("1.2")) def test_string(): np.longdouble("1.2") def test_bytes(): np.longdouble(b"1.2") @in_foreign_locale def test_fromstring_foreign(): f = 1.234 a = np.fromstring(repr(f), dtype=float, sep=" ") assert_equal(a[0], f) @dec.knownfailureif(string_to_longdouble_inaccurate, "Need strtold_l") def test_repr_roundtrip_bytes(): o = 1 + np.finfo(np.longdouble).eps assert_equal(np.longdouble(repr(o).encode("ascii")), o) @in_foreign_locale def test_repr_roundtrip_foreign(): o = 1.5 assert_equal(o, np.longdouble(repr(o))) def test_bogus_string(): assert_raises(ValueError, np.longdouble, "spam") assert_raises(ValueError, np.longdouble, "1.0 flub") @dec.knownfailureif(string_to_longdouble_inaccurate, "Need strtold_l") def test_fromstring(): o = 1 + np.finfo(np.longdouble).eps s = (" " + repr(o))*5 a = np.array([o]*5) assert_equal(np.fromstring(s, sep=" ", dtype=np.longdouble), a, err_msg="reading '%s'" % s) @in_foreign_locale def test_fromstring_best_effort_float(): assert_equal(np.fromstring("1,234", dtype=float, sep=" "), np.array([1.])) @in_foreign_locale def test_fromstring_best_effort(): assert_equal(np.fromstring("1,234", dtype=np.longdouble, sep=" "), np.array([1.])) def test_fromstring_bogus(): assert_equal(np.fromstring("1. 2. 3. flop 4.", dtype=float, sep=" "), np.array([1., 2., 3.])) def test_fromstring_empty(): assert_equal(np.fromstring("xxxxx", sep="x"), np.array([])) def test_fromstring_missing(): assert_equal(np.fromstring("1xx3x4x5x6", sep="x"), np.array([1])) class FileBased(TestCase): ldbl = 1 + np.finfo(np.longdouble).eps tgt = np.array([ldbl]*5) out = ''.join([repr(t) + '\n' for t in tgt]) def test_fromfile_bogus(self): with temppath() as path: with open(path, 'wt') as f: f.write("1. 2. 3. flop 4.\n") res = np.fromfile(path, dtype=float, sep=" ") assert_equal(res, np.array([1., 2., 3.])) @dec.knownfailureif(string_to_longdouble_inaccurate, "Need strtold_l") def test_fromfile(self): with temppath() as path: with open(path, 'wt') as f: f.write(self.out) res = np.fromfile(path, dtype=np.longdouble, sep="\n") assert_equal(res, self.tgt) @dec.knownfailureif(string_to_longdouble_inaccurate, "Need strtold_l") def test_genfromtxt(self): with temppath() as path: with open(path, 'wt') as f: f.write(self.out) res = np.genfromtxt(path, dtype=np.longdouble) assert_equal(res, self.tgt) @dec.knownfailureif(string_to_longdouble_inaccurate, "Need strtold_l") def test_loadtxt(self): with temppath() as path: with open(path, 'wt') as f: f.write(self.out) res = np.loadtxt(path, dtype=np.longdouble) assert_equal(res, self.tgt) @dec.knownfailureif(string_to_longdouble_inaccurate, "Need strtold_l") def test_tofile_roundtrip(self): with temppath() as path: self.tgt.tofile(path, sep=" ") res = np.fromfile(path, dtype=np.longdouble, sep=" ") assert_equal(res, self.tgt) @in_foreign_locale def test_fromstring_foreign(): s = "1.234" a = np.fromstring(s, dtype=np.longdouble, sep=" ") assert_equal(a[0], np.longdouble(s)) @in_foreign_locale def test_fromstring_foreign_sep(): a = np.array([1, 2, 3, 4]) b = np.fromstring("1,2,3,4,", dtype=np.longdouble, sep=",") assert_array_equal(a, b) @in_foreign_locale def test_fromstring_foreign_value(): b = np.fromstring("1,234", dtype=np.longdouble, sep=" ") assert_array_equal(b[0], 1) # Conversions long double -> string def test_repr_exact(): o = 1 + np.finfo(np.longdouble).eps assert_(repr(o) != '1') @dec.knownfailureif(longdouble_longer_than_double, "BUG #2376") @dec.knownfailureif(string_to_longdouble_inaccurate, "Need strtold_l") def test_format(): o = 1 + np.finfo(np.longdouble).eps assert_("{0:.40g}".format(o) != '1') @dec.knownfailureif(longdouble_longer_than_double, "BUG #2376") @dec.knownfailureif(string_to_longdouble_inaccurate, "Need strtold_l") def test_percent(): o = 1 + np.finfo(np.longdouble).eps assert_("%.40g" % o != '1') @dec.knownfailureif(longdouble_longer_than_double, "array repr problem") @dec.knownfailureif(string_to_longdouble_inaccurate, "Need strtold_l") def test_array_repr(): o = 1 + np.finfo(np.longdouble).eps a = np.array([o]) b = np.array([1], dtype=np.longdouble) if not np.all(a != b): raise ValueError("precision loss creating arrays") assert_(repr(a) != repr(b)) if __name__ == "__main__": run_module_suite()
Upload File
Create Folder