o 6a@sFdZddlZddlZddlZddlZddlmZmZGdddZ dS)z; Test the scalar constructors, which also do type-coercion N) assert_equal assert_raisesc@s8eZdZejdejejej ej gejdgdddZ ejdejejej ej gddZ ejdejejej ej gdd Z d d Zejd ejgd gdfejgdgdfej gdgdfejej gdgdejjeej eej kddejjedddgdgddZdS)TestAsIntegerRatioftypezf, ratio))g?))g)ir))r)g'@)cCst|||dS)N)ras_integer_ratio)selfrfratiorF/usr/lib/python3/dist-packages/numpy/core/tests/test_scalar_methods.py test_smalls zTestAsIntegerRatio.test_smallcCsztj}t|dd||dt|dd||dt|dd||dt|dd||d dS) Nrr rr g@g?igh) fractionsFractionrr )r rRrrrtest_simple_fractionss    z(TestAsIntegerRatio.test_simple_fractionscCs4tt|djtt|djtt|djdS)Ninfz-infnan)r OverflowErrorr ValueError)r rrrr test_errors(szTestAsIntegerRatio.test_errorscCstj}t|dd|tdt|dd|tdt|dd|tdt|dd|tdt|d d |tdt|d d |tddS) Ni3ig@igi33Ci i̼lL33l@lL33)rrrnphalfr singledouble)r rrrrtest_against_known_values/s&      z,TestAsIntegerRatio.test_against_known_valueszftype, frac_vals, exp_vals)rgu?gi(?g1?g_?)rr ri )rg%?g?g1,B?gJfu?)rr" i)rgBП?gɱk?gu&>L?gFO?)ri3is)rgMJ;?gޫ_?gКAQ?g8O?)rii7irizlong double is same as double)reasonppczIBM double double)marksc Cst||D]F\}}t|||}|j|ksJ|\}}ztt|} tt|} Wnttfy>t dYnwt | | |d ||qdS)Nz%longdouble too small on this platformz{}/{}) ziprldexpdtyper longdoublestrrRuntimeWarningpytestskiprformat) r r frac_valsexp_valsfracexprndnfdfrrrtest_roundtrip?s z!TestAsIntegerRatio.test_roundtripN)__name__ __module__ __qualname__r0mark parametrizerrrr r-rrrr!paramskipiffinfoplatformmachine startswithr;rrrrr sR        r) __doc__rrDr0numpyr numpy.testingrrrrrrrs