o 6ah@sdZddlZddlZddlmZmZmZGdddZGdddZ Gdd d Z ej ej ej ejejgZejejejejejgZejejejejgZejejejgZGd d d Z dS) z; Test the scalar constructors, which also do type-coercion N) assert_equalassert_almost_equal assert_warnsc@eZdZddZddZdS)TestFromStringcCs@td}td}td}t|dt|dt|ddS)Nz1.234gX9v?)npsingledouble longdoubler)selffsinglefdouble flongdoublerD/usr/lib/python3/dist-packages/numpy/core/tests/test_scalar_ctors.py test_floating s     zTestFromString.test_floatingcCstd}t|tjtd}t|tjtd}t|tjtttjd}t|tjtd}t|tj td}t|tj td}t|tj tttjd}t|tj dS)z6 Strings containing an unrepresentable float overflow 1e10000z-1e10000N) rhalfrinfrr rRuntimeWarningr )r fhalfr r rrrrtest_floating_overflows          z%TestFromString.test_floating_overflowN)__name__ __module__ __qualname__rrrrrrr s rc@s,eZdZddZddZddZddZd S) TestExtraArgscCstjddd}|dks Jtdd}|dksJtttjdddWdn1s0wYtttddWdn1sKwYtddksYJdS)Ns\x61zunicode-escape)encodingas\xxs-2)rstr_pytestraisesUnicodeDecodeErrorbytes_)r srrrtest_superclass+s     zTestExtraArgs.test_superclasscCs\tdd}t|dksJtttjdddWddS1s'wYdS)Nz2000-01)M2000Tgarbage)r datetime64 datetime_datar r! TypeError)r dtrrr test_datetime;s  "zTestExtraArgs.test_datetimecC>tttjdddWddS1swYdS)NFTr))r r!r-rbool_r rrr test_boolB "zTestExtraArgs.test_boolcCr0)NstestTr))r r!r-rvoidr2rrr test_voidFr4zTestExtraArgs.test_voidN)rrrr%r/r3r6rrrrr*s  rc@r) TestFromIntcCstdtddS)Ni)rrintpr2rrr test_intpLszTestFromInt.test_intpcCsttdtddS)Nrl)rruint64r2rrrtest_uint64_from_negativePsz%TestFromInt.test_uint64_from_negativeN)rrrr9r;rrrrr7Ks r7c@seZdZdZddZejdee ejdee dgddZ ejde ejde dgd d Z ejde ejde dgd d ZdS) TestArrayFromScalarz gh-15467 cCsF|d}tj||d}|dur|jj|usJdS|jj|us!JdS)Nr')dtype)rarrayr=type)r t1t2xarrrrr_do_test]s zTestArrayFromScalar._do_testr@rANcC |||SNrDr r@rArrr test_integersf z!TestArrayFromScalar.test_integerscCrErFrGrHrrr test_realskrJzTestArrayFromScalar.test_realscCrErFrGrHrrr test_complexprJz TestArrayFromScalar.test_complex)rrr__doc__rDr mark parametrize int_types uint_typesrI float_typesrK cfloat_typesrLrrrrr<Zs     r<)!rMr numpyr numpy.testingrrrrrr7byteshortintcint_longlongrPubyteushortuintcuint ulonglongrQrrr r rRcsinglecdouble clongdoublerSr<rrrrs!