ó 2ÄÈ[c@`sVddlmZmZmZddlZddlZddlmZm Z m Z ddl m Z ej ddkr†ddlmZnddlmZidej6dej 6d ej6Zd „Zd „Zd „Zd „Zd„Zd„Zd„Zd„Zdd„Zd„Zd„Zd„Zd„Z d„Z!de fd„ƒYZ"dS(i(tdivisiontabsolute_importtprint_functionN(tassert_t assert_equaltSkipTest(tCommaDecimalPointLocalei(tStringIOtinfs-inftnancC`sÀxIddddgD]5}tt||ƒƒtt|ƒƒdd|ƒqW|dƒjdkr“tt|dƒƒttd ƒƒdd|ƒn)d }tt|dƒƒ|dd|ƒdS( Niiiÿÿÿÿg@Œµx¯Dterr_msgs!Failed str formatting for type %sg€à7yÃACit1e16s1e+16(Rtstrtfloattitemsize(ttptxtref((s:/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_print.pytcheck_float_types$$cC`s1x*tjtjtjgD]}t|ƒqWdS(sÌ Check formatting. This is only for the str function, and only for simple types. The precision of np.float32 and np.longdouble aren't the same as the python float precision. N(tnptfloat32tdoublet longdoubleR(tt((s:/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_print.pyttest_float_typesscC`sOxHtjtj tjgD]-}tt||ƒƒt|dd|ƒqWdS(NR s!Failed str formatting for type %s(RRR RR t_REF(RR((s:/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_print.pytcheck_nan_inf_float*s cC`s1x*tjtjtjgD]}t|ƒqWdS(sÙ Check formatting of nan & inf. This is only for the str function, and only for simple types. The precision of np.float32 and np.longdouble aren't the same as the python float precision. N(RRRRR(R((s:/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_print.pyttest_nan_inf_float/scC`s6x¿ddddgD]«}tt||ƒƒtt|ƒƒdd|ƒtt||dƒƒtt|dƒƒdd|ƒtt|||dƒƒtt||dƒƒdd|ƒqW|dƒjd kr tt|dƒƒttdƒƒdd|ƒn)d }tt|dƒƒ|dd|ƒdS( Niiiÿÿÿÿg@Œµx¯DR s!Failed str formatting for type %syð?g€à7yÃACis (1e+16+0j)(RR tcomplexR(RRR((s:/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_print.pytcheck_complex_type:s$ , 4$cC`s1x*tjtjtjgD]}t|ƒqWdS(sÜCheck formatting of complex types. This is only for the str function, and only for simple types. The precision of np.float32 and np.longdouble aren't the same as the python float precision. N(Rt complex64tcdoublet clongdoubleR(R((s:/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_print.pyttest_complex_typesKscC`s’idttjdƒ6dtdtjƒ6dttj dƒ6dtdtj ƒ6dttjdƒ6dtdtjƒ6d ttj dƒ6d tdtj ƒ6d ttjdƒ6d tdtjƒ6d ttj dƒ6d tdtj ƒ6d ttjdƒ6dtdtjƒ6d ttj dƒ6dtdtj ƒ6}xMtjtjtjgD]3}x*|jƒD]\}}t|||ƒqjWqWWdS(s*Check inf/nan formatting of complex types.s(inf+0j)itinfjs (-inf+0j)s-infjs(inf+1j)is(1+infj)s (-inf+1j)s(1-infj)s(nan+0j)tnanjs(nan+1j)s(1+nanj)N( RRRR RRR titemst_check_complex_inf_nan(tTESTSRtcts((s:/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_print.pyttest_complex_inf_nanVs(cC`stt||ƒƒ|ƒdS(N(RR (R'R(tdtype((s:/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_print.pyR%nscC`s’tƒ}tƒ}tj}zC|t_t||ƒƒ|t_|rSt|ƒn t|ƒWd|t_Xt|jƒ|jƒdd|ƒdS(NR sprint failed for type%s(RtsyststdouttprintRtgetvalue(RRRtfiletfile_tpR,((s:/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_print.pyt_test_redirected_printrs       cC`s¹x-ddddgD]}tt|ƒ|ƒqWx;tjtj tjgD] }tt|ƒ|t|ƒqJW|dƒjdkr™ttdƒ|ƒnd}ttdƒ||ƒdS(Niiiÿÿÿÿg@Œµx¯Dg€à7yÃACis1e+16(R1R RRR RR(RRR((s:/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_print.pytcheck_float_type_print„s cC`sÑx-ddddgD]}tt|ƒ|ƒqW|dƒjdkr[ttdƒ|ƒnd}ttdƒ||ƒtttjdƒ|dƒtttj dƒ|d ƒtttj dƒ|d ƒdS( Niiiÿÿÿÿg@Œµx¯Dg€à7yÃACis (1e+16+0j)s(inf+1j)s (-inf+1j)s(nan+1j)(R1RRRRR (RRR((s:/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_print.pytcheck_complex_type_print‘scC`s1x*tjtjtjgD]}t|ƒqWdS(s"Check formatting when using print N(RRRRR2(R((s:/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_print.pyttest_float_type_print¡scC`s1x*tjtjtjgD]}t|ƒqWdS(s"Check formatting when using print N(RRRR R3(R((s:/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_print.pyttest_complex_type_print¦scC`sždttjfdttjfddtjfddtjfddtjfddtjfddtjfddtj fdd tj fdd tj fd d tj fd d tj fd d tjfd d tjfd dtjfd dtjfd dtjfg}x’|D]Š\}}}y6t|j|ƒ|j||ƒƒd||fƒWq tk r•}ttd|t|ƒt|ƒt|ƒfƒq Xq WdS(s2Test the str.format method with NumPy scalar typess{0}s{0:d}i‚iPÃI^вl¸RU iˆÿÿÿiЊÿÿilʈIDlÛžs{0:g}gø?yà?sfailed with val %s, type %ss=format raised exception (fmt='%s', val=%s, type=%s, exc='%s')Nyø?à?yø?à?yø?à?(tTrueRtbool_tFalsetuint8tuint16tuint32tuint64tint8tint16tint32tint64tfloat16Rtfloat64RRt complex128R Rtformatt ValueErrorRtreprR (tteststfmattvaltvaltypete((s:/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_print.pyttest_scalar_format«s2!tTestCommaDecimalPointLocalecB`s#eZd„Zd„Zd„ZRS(cC`s,tttjdƒƒttdƒƒƒdS(Ng333333ó?(RR RRR (tself((s:/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_print.pyttest_locale_singleÏscC`s,tttjdƒƒttdƒƒƒdS(Ng333333ó?(RR RRR (RN((s:/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_print.pyttest_locale_doubleÒscC`s,tttjdƒƒttdƒƒƒdS(Ns1.2g333333ó?(RR RRR (RN((s:/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_print.pyttest_locale_longdoubleÕs(t__name__t __module__RORPRQ(((s:/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_print.pyRMÍs  (#t __future__RRRR+tnumpyRt numpy.testingRRRtnumpy.core.tests._localesRt version_infotioRRR RRRRRRR!R)R%tNoneR1R2R3R4R5RLRM(((s:/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_print.pyts.  %         "