K iddlZddlZddlZddlZddlZddlZddlZddlZddlZ ddl m Z ddl m Z Gdde jZGddeZGd d e jZGd d e jZGd de jZej(j*ej(j-ej.j1dk(ddGdde jZy)N)IS_PYPY)utilceZdZejddddgZejjdddgejjdZ ejje d d Z d Zejjej"d k(d dZejjej"d k(d dZdZdZy)TestF77Callbacktestssrccallbackzfoo.fnamett2c&|j|yN)check_function)selfr s d/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/numpy/f2py/tests/test_callback.pytest_allzTestF77Callback.test_alls D!z,PyPy cannot modify tp_doc after PyType_Ready)reasoncxtjd}|jjj|k(sJy)Na a = t(fun,[fun_extra_args]) Wrapper for ``t``. Parameters ---------- fun : call-back function Other Parameters ---------------- fun_extra_args : input tuple, optional Default: () Returns ------- a : int Notes ----- Call-back functions:: def fun(): return a Return objects: a : int )textwrapdedentmoduler __doc__)rexpecteds rtest_docstringzTestF77Callback.test_docstrings5??$  4{{}}$$000rct|j|}|d}|dk(sJ|dd}|dk(sJ|dd}|dk(sJ|d d }|d k(sJ|tjtjf}|d k(sJ|tjtjf}|d k(sJ||jj d}|d k(sJ||jj }|dk(sJ||jj j}|dk(sJGdd}|}||}|dk(sJ||j}|dk(sJy)Ncy)Nr rrz0TestF77Callback.check_function..:rrcyNr as rr!z0TestF77Callback.check_function..<r"r))fun_extra_argsr%c|Srr r&s rr!z0TestF77Callback.check_function..>srr(c d|zSr$r r&s rr!z0TestF77Callback.check_function..@s Ar)  ceZdZdZdZy))TestF77Callback.check_function..Acy)Nr,r rs r__call__z2TestF77Callback.check_function..A.__call__Orcy)N r r4s rmthz-TestF77Callback.check_function..A.mthRr6rN)__name__ __module__ __qualname__r5r9r rrAr2Ns   rr=r,r8) getattrrmathdegreespifuncfunc0 _cpointerr9)rr r rr=r's rrzTestF77Callback.check_function8sQ DKK & iLAv v k% 0Av v k% 0Av v oe 4Bww dllDGG; 7Cxx dllDGG; 7Cxx dkku 5Bww dkk Bww dkk)) *Bww   C aDAv v aeeHAv vrwin32z)Fails with MinGW64 Gfortran (Issue #9673)cTd}|jj}||}|dk(sJy)Nc|dk(ryy)NrErrr )codes rr z6TestF77Callback.test_string_callback..callback^ss{rr)rstring_callback)rr frEs rtest_string_callbackz$TestF77Callback.test_string_callback[s,  KK ' ' hKAv vrctjdd}tjdd}tjdgd}d}|jj}|||fD]}||||j }|dk(rJy)N)rS8)rccx|j|fk7ry|jdk7rytj|dk(syy)NrrNrr)shapedtypenpall)culencus rr z.callbackps8xxE8#xx466")$rr)rWzerosarrayrstring_callback_arraysize)rcu1cu2cu3r rKrYress rtest_string_callback_arrayz*TestF77Callback.test_string_callback_arrayhs~hhud#hhvs#hhtT"  KK - -S/ BHb"''*C!8O8 rc 8gfdfd}dDcgc]*}tdD]}tj||f,}}}|D]}|j|D]}|j dj r t ycc}}w)Ncvtjdjjd}|dk(sJy)NgMbP?cyN{r r rrr!z?TestF77Callback.test_threadsafety..cb..r"rrh*)timesleeprr )rErs rcbz-TestF77Callback.test_threadsafety..cbs3 JJt  k*A8O8rc tdD]5}jj}|dk(sJj|7y#t$r&j t jYywxYw)N2ri)rangerr r Exceptionappend traceback format_exc)r jrErlerrorsrs rrunnerz1TestF77Callback.test_threadsafety..runnersl 6r.A b)A7N7''-. 6 i2245 6sAA,A65A6)r r )targetargsz )ro threadingThreadstartjoinAssertionError)rrvargnthreadsr rlrus` @@rtest_threadsafetyz!TestF77Callback.test_threadsafety~s  6# E"I '(   F# 9 9   A GGI  A FFH V$  ( (  s/Bcr |jjd |jj dd|j_|jjd}|dk(sJd|j_|jjd}|dk(sJ|j` |jjdd d|j_|jjd}|d k(sJ|jj d}|dk(sJy#t$r'}t|j dsJYd}~/d}~wwxYw#t$r'}t|j dsJYd}~Fd}~wwxYw#t$r&}t|j dsJYd}~d}~wwxYw) NrSzCallback global_f not definedz!cb: Callback global_f not definedc |dzS)Nrr xs rr!z6TestF77Callback.test_hidden_callback.. QrrTc |dzS)NrSr rs rr!z6TestF77Callback.test_hidden_callback..rrrc |dzS)NrTr rs rr!z6TestF77Callback.test_hidden_callback..s 1q5rr%)r)rhidden_callbackrpstr startswithhidden_callback2global_f)rmsgrEs rtest_hidden_callbackz$TestF77Callback.test_hidden_callbacks H KK ' ' * L KK ( ( + /  KK ' ' *Av v.  KK ' ' *Av v KK  H KK ' ' * 1  KK ' ' *Av v KK ( ( +Av v9 Hs8&&'FG GG H  Ls8&&'JK KK L Hs8&&'FG GG HsFD!E.F! E*E  E FE??F F6F11F6N)r:r;r<rgetpathsourcespytestmark parametrizeslowrxfailrrrskipifsysplatformrLrcrrr rrrrst||GUJ@AG [[Vc4[1 [["2" [[wLN1N1:!F [[ /JL L  [[ /JLL(&)PrrceZdZdZdgZy)TestF77CallbackPythonTLSz[ Callback tests using Python thread-local storage instead of compiler-provided z-DF2PY_USE_PYTHON_TLSN)r:r;r<roptionsr rrrrs ''GrrcpeZdZejddddgZejjdZ y)TestF90Callbackrr r z gh17797.f90cd}tjgdtj}|jj ||}|dk(sJy)Nc |dzSrgr rs rincrz*TestF90Callback.test_gh17797..incrs s7Nr)rrSrT)rV)rWr\int64rgh17797)rryrEs r test_gh17797zTestF90Callback.test_gh17797sA  HHYbhh / KK  a (O###rN) r:r;r<rrrrrrrr rrrrs7t||GUJ FGG [[$$rrcteZdZdZej ddddgZejjdZ y) TestGH18335zThe reproduction of the reported issue requires specific input that extensions may break the issue conditions, so the reproducer is implemented as a separate test class. Do not extend this test with other tests! rr r z gh18335.f90cNd}|jj|}|dk(sJy)Nc|dxxdz cc<y)Nrrr rs rfooz%TestGH18335.test_gh18335..foos aDAIDr|)rgh18335)rrrEs r test_gh18335zTestGH18335.test_gh18335s)  KK   $G||rN) r:r;r<rrrrrrrrr rrrrs> t||GUJ FGG [[rrcjeZdZejddddejddddgZdZdZy) TestGH25211rr r z gh25211.fz gh25211.pyf callback2cNd}|jj|}|dk(sJy)Nc ||zSrr rs rbarz%TestGH25211.test_gh25211..bars q5Lrn)rr)rrrbs r test_gh25211zTestGH25211.test_gh25211s' kkooc"czzrN)r:r;r<rrr module_namerr rrrrs<t||GUJ Dt||GUJ FHGKrrdarwinFz*Callback aborts cause CI failures on macOS) conditionrunrcDeZdZejddddgZdgZdZy)TestCBFortranCallstatementrr r z gh26681.f90z--lowerc tjtd5}|jjj |j_|jjjddddy#1swYyxYw)Nhelpme)match)rraises ValueErrorrutilsmy_abort mypy_abort do_something)rexcs rtest_callstatement_fortranz5TestCBFortranCallstatement.test_callstatement_fortrans[ ]]:X 6 5#%)[[%6%6%?%?DKK " KK   * *8 4 5 5 5s AA::BN)r:r;r<rrrrrr rrrrs) t||GUJ FGGkG5rr)r?rrrrzrjrrrnumpyrW numpy.testingrrQrF2PyTestrrrrrrrrsystemlowerrr rrrs    !tdmmtn(( $dmm $$--" $-- ohoo/5578CFH55H5r