K iA_dZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl m Z ddl m Z ddlZddlmZmZddlZddlZddlZddlZddlZddlZddlZddlmZddlmZddlmZdd lmZdd l m!Z!dd l"m#Z#ejHd k(Z%ejLd dZ'gdZ(gdZ)Gdde*Z+Gdde*Z,Gdde*Z-dAdZ.e.e_.dZ/e%re/e_0dZ1dZ2dBdZ3edZ4ddejjddfd Z6 dCd!Z7ddd"d#Z8dd$dddddddddddddddd%d&Z9ddd"d'Zd(Z:d)Z;ejxd*Z=dDd+Z>dd,l?m@Z@e@d-d.ZAdddddddddejdf d/ZCGd0d1ZDGd2d3ZEGd4d5eZFGd6d7eZGgd8ZHeHD]ZId9eIzZJd:eIzZKeLeGeKeMeeJGd;dZPGd?d@ePZQy)EaF This is our testing framework. Goals: * it should be compatible with py.test and operate very similarly (or identically) * does not require any external dependencies * preferably all the functionality should be in this file only * no magic, just import the test file and execute the test functions, that's it * portable N)fnmatch) default_timer) DocTestFinder DocTestRunner)contextmanager)unwrap)Path) clear_cache) import_module) GROUND_TYPESntCI)d 0*x?g_vOf?g_Q{?/nR?a2U0*C?gw?UN@s?gHPsr?Mbp?gp_Q?g_Q[?_Le?r-C6j?-C6Z?~jtX?-C6:?rrǺV?g ??߾?gJY8?g_vO~?g"uq?gS!uq{?g 0*?rg~:p?gZӼ?ggj+?a2U0*3?rrr_LU?r-C6J?ǺF?rgPkw?rr爅ZӼt?Mb`?rMb@?g䃞ͪϕ?ga2U0*s?ra2U0*S?ra2U0*c?rrr!rgI +?ga+ey?rgJ4a?nt?rrrrgŏ1w-!_?~jth?g/nr?g_vOv?+eXw?r$rrgH}M?rr"rg2%䃎?g]K=?gŏ1w-!?g ^)p?r#gS㥋?gǘ?gׁsF?g9m4?gw-!l?gHP?rr rrgqo?r#r!rr%gy&1?r)(g"u?rgZӼ?rrr!rrrgǘ?gׁsF?g r?gJ +?r!g-C6z?rrrrrgy):?r#gF%uk?r&r!rgMbP?g;Onr?g&S?rr!g8gDio?rg}?5^I?gS?gW/'?rrrg_)Ǻ?c eZdZy)SkippedN__name__ __module__ __qualname__\/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/sympy/testing/runtests.pyr(r(Xr.r(c eZdZy) TimeOutErrorNr)r-r.r/r2r2[r0r.r2c eZdZy)DependencyErrorNr)r-r.r/r4r4^r0r.r4c6tjd|dz|S)z Add the given number of space characters to the beginning of every non-blank line in ``s``, and return the result. If the string ``s`` is Unicode, it is encoded using the stdout encoding and the ``backslashreplace`` error handler. z (?m)^(?!$) )resub)sindents r/_indentr;bs 66,s A ..r.c|jj|||j}|jdj dd}||j |||zy)z/ Report that the given example failed. raw_unicode_escapeutf8ignoreN)_checkeroutput_difference optionflagsencodedecode_failure_header)selfouttestexamplegotr9s r/_report_failurerKrsX ''d6F6FGA %&--fh?AT7+a/0r.cZg}|D]}tjj|jd}tj dk(r5|j d}|dk7r||dzdk7r|d|dzdz||dzdz}|jtjj||S)z Converts a list of '/' separated paths into a list of native (os.sep separated) paths and converts to lowercase if the system is case insensitive. /win32:\N) ospathjoinsplitsysplatformfindappendnormcase)lstnewlstrvposs r/convert_to_native_pathsr`s F, WW\\288C= ) <<7 "''#,CbycAg;$&HS1W,r#'(|;B bgg&&r*+, Mr.c@tjjt}tjj tjj |dd}tjj |}tjj|S)z Returns the root SymPy directory and set the global value indicating whether the system is case sensitive or not. z..)rSrTabspath__file__rUdirnamenormpathr[) this_file sympy_dirs r/ get_sympy_dirrhsb )I RWW__Y7tDI  +I 77  I &&r.Tcddlm}ddlm}ddlmcm}ddlm}d|_|d}|j}|rd|_ |d||fS)Nr) init_printingpprint_use_unicode stringpictTF) pretty_print) sympy.interactive.printingrjsympy.printing.pretty.prettyrl interactiveprintingsympy.printing.prettyrn NO_GLOBAL_GLOBAL_WRAP_LINE)disable_line_wraprjrlinteractive_printingrnuse_unicode_prevwrap_line_prevs r/ setup_pprintr{sV8?==0&*"*%0 11N', $u% ^ ++r.c#Ktj5tjddtdddddy#1swYyxYww)a+Context manager to make DeprecationWarning raise an error This is to catch SymPyDeprecationWarning from library code while running tests and doctests. It is important to use this context manager around each individual test/doctest in case some tests modify the warning filters. errorz.*zsympy.*)moduleN)warningscatch_warningsfilterwarningsDeprecationWarningr-r.r/raise_on_deprecatedrs@  "/A)T sA"A AA Ar-zsympy.testing.runtestsFc 4t}tj|dgtjtj|}|j |j dk7rytjd}|s0ttjdtjd<n|sy|xsi}d|d|d |d t|d t|d } tj|d d| g|}|j |tjd=|j S|tjd<|j S#t$r|jYYwxYw#|tjd=n|tjd<|j ccYSxYw)a Run a function in a Python subprocess with hash randomization enabled. If hash randomization is not supported by the version of Python given, it returns False. Otherwise, it returns the exit value of the command. The function is passed to sys.exit(), so the return value of the function will be the return value. The environment variable PYTHONHASHSEED is used to seed Python's hash randomization. If it is set, this function will return False, because starting a new subprocess is unnecessary in that case. If it is not set, one is set at random, and the tests are run. Note that if this environment variable is set when Python starts, hash randomization is automatically enabled. To force a subprocess to be created even if PYTHONHASHSEED is set, pass ``force=True``. This flag will not force a subprocess in Python versions that do not support hash randomization (see below), because those versions of Python do not support the ``-R`` flag. ``function`` should be a string name of a function that is importable from the module ``module``, like "_test". The default for ``module`` is "sympy.testing.runtests". ``function_args`` and ``function_kwargs`` should be a repr-able tuple and dict, respectively. The default Python command is sys.executable, which is the currently running Python command. This function is necessary because the seed for hash randomization must be set by the environment variable before Python starts. Hence, in order to use a predetermined seed for tests, we must start Python in a separate subprocess. Hash randomization was added in the minor Python versions 2.6.8, 2.7.3, 3.1.5, and 3.2.3, and is enabled by default in all Python versions after and including 3.3.0. Examples ======== >>> from sympy.testing.runtests import ( ... run_in_subprocess_with_hash_randomization) >>> # run the core tests in verbose mode >>> run_in_subprocess_with_hash_randomization("_test", ... function_args=("core",), ... function_kwargs={'verbose': True}) # doctest: +SKIP # Will return 0 if sys.executable supports hash randomization and tests # pass, 1 if they fail, and False if it does not support hash # randomization. z-RV)stdoutstderrcwdrFPYTHONHASHSEEDlzimport sys; from z import z ;sys.exit(z(*z, **z))z-Rz-c)r)rh subprocessPopenPIPESTDOUT communicate returncoderSgetenvstrrandom randrangeenvironreprKeyboardInterruptwait) function function_argsfunction_kwargscommandr~forcerp hash_seed commandstrings r/)run_in_subprocess_with_hash_randomizationrs\f /C '5)*// * 1 1s >> from sympy.testing.runtests import run_all_tests >>> run_all_tests(test_args=("solvers",), ... test_kwargs={"colors:False"}) # doctest: +SKIP TquietFexamplesr) run_examplesNrQDO *NOT* COMMIT!) rHprintdoctestrWrTrZallrexitr) test_args test_kwargs doctest_argsdoctest_kwargs examples_argsexamples_kwargstests_successfulrs r/ run_all_testsrs,#K#)rN%8'4OY.+. %   77$    #$]>o>$    HHQK    !  sAB8B3CC)rreruncfd}|rEtddD]5}||td||}|durnt| }|r|dk(s3|cStddD]*}||tt|i| }|r|dk(s(|cSy)a Run tests in the specified test_*.py files. Tests in a particular test_*.py file are run if any of the given strings in ``paths`` matches a part of the test file's path. If ``paths=[]``, tests in all test_*.py files are run. Notes: - If sort=False, tests are run in random order (not default). - Paths can be entered in native system format or in unix, forward-slash format. - Files that are on the blacklist can be tested by providing their path; they are only excluded if no paths are given. **Explanation of test results** ====== =============================================================== Output Meaning ====== =============================================================== . passed F failed X XPassed (expected to fail but passed) f XFAILed (expected to fail and indeed failed) s skipped w slow T timeout (e.g., when ``--timeout`` is used) K KeyboardInterrupt (when running the slow tests with ``--slow``, you can interrupt one of them without killing the test runner) ====== =============================================================== Colors have no additional meaning and are used just to facilitate interpreting the output. Examples ======== >>> import sympy Run all tests: >>> sympy.test() # doctest: +SKIP Run one file: >>> sympy.test("sympy/core/tests/test_basic.py") # doctest: +SKIP >>> sympy.test("_basic") # doctest: +SKIP Run all tests in sympy/functions/ and some particular file: >>> sympy.test("sympy/core/tests/test_basic.py", ... "sympy/functions") # doctest: +SKIP Run all tests in sympy/core and sympy/utilities: >>> sympy.test("/core", "/util") # doctest: +SKIP Run specific test from a file: >>> sympy.test("sympy/core/tests/test_basic.py", ... kw="test_equality") # doctest: +SKIP Run specific test from any file: >>> sympy.test(kw="subs") # doctest: +SKIP Run the tests with verbose mode on: >>> sympy.test(verbose=True) # doctest: +SKIP Do not sort the test output: >>> sympy.test(sort=False) # doctest: +SKIP Turn on post-mortem pdb: >>> sympy.test(pdb=True) # doctest: +SKIP Turn off colors: >>> sympy.test(colors=False) # doctest: +SKIP Force colors, even when the output is not to a terminal (this is useful, e.g., if you are piping to ``less -r`` and you still want colors) >>> sympy.test(force_colors=False) # doctest: +SKIP The traceback verboseness can be set to "short" or "no" (default is "short") >>> sympy.test(tb='no') # doctest: +SKIP The ``split`` option can be passed to split the test run into parts. The split currently only splits the test files, though this may change in the future. ``split`` should be a string of the form 'a/b', which will run part ``a`` of ``b``. For instance, to run the first half of the test suite: >>> sympy.test(split='1/2') # doctest: +SKIP The ``time_balance`` option can be passed in conjunction with ``split``. If ``time_balance=True`` (the default for ``sympy.test``), SymPy will attempt to split the tests such that each split takes equal time. This heuristic for balancing is based on pre-recorded test data. >>> sympy.test(split='1/2', time_balance=True) # doctest: +SKIP You can disable running the tests in a separate subprocess using ``subprocess=False``. This is done to support seeding hash randomization, which is enabled by default in the Python versions where it is supported. If subprocess=False, hash randomization is enabled/disabled according to whether it has been enabled or not in the calling Python process. However, even if it is enabled, the seed cannot be printed unless it is called from a new Python process. Hash randomization was added in the minor Python versions 2.6.8, 2.7.3, 3.1.5, and 3.2.3, and is enabled by default in all Python versions after and including 3.3.0. If hash randomization is not supported ``subprocess=False`` is used automatically. >>> sympy.test(subprocess=False) # doctest: +SKIP To set the hash randomization seed, set the environment variable ``PYTHONHASHSEED`` before running the tests. This can be done from within Python using >>> import os >>> os.environ['PYTHONHASHSEED'] = '42' # doctest: +SKIP Or from the command line using $ PYTHONHASHSEED=42 ./bin/test If the seed is not set, a random seed will be chosen. Note that to reproduce the same hash values, you must use both the same seed as well as the same architecture (32-bit vs. 64-bit). c4|z rtd|z zSdSNzrerun %drirs r/ztest..'#(7!&jE!G&< =04r.rP_testrrFrN)rangerboolrrrpathskwargs print_counterrretvals ` r/rHrHXs^6Mub"% A ! ;G&+VECe|3i-C!q&  5"b !aue.v.//a1fJ r.short)verbosetbkwpdbcolors force_colorssortseedtimeoutfail_on_timeoutslowenhance_assertsrV time_balance blacklistfast_thresholdslow_thresholdc |xsd}t|tr|f}|}|tjd}tr|durd}d} trt |dgz}t |}t||||| }g}|D]2}d |vr|jd d \}}||fz }|j|4|}t|||||| }|jd }|Dcgc]tfd |Ds}}t|dk(r|}n]t |}g}|D]Ktjj!}|D]%}|vs t#||s|jKMd}| r| rt$}nt&}| rt)|| |}|j*j-|t/|j1||| | |  Scc}w)a Internal function that actually runs the tests. All keyword arguments from ``test()`` are passed to this function except for ``subprocess``. Returns 0 if tests passed and 1 if they failed. See the docstring of ``test()`` for more information. r-NiFiSTzsympy/plotting/pygletplot/tests)rrrrrV::rQ)rrsympyc3&K|]}|v ywNr-.0bfs r/ z_test...!Q!!<)!<<>O> 5zQ!'.  Aww''*H 6WXq1NN1%  G (G#G WeW=LL 166tW4'JJ KK7>sF?cfd}|rEtddD]5}||td||}|durnt| }|r|dk(s3|cStddD]*}||tt|i| }|r|dk(s(|cSy)a Runs doctests in all \*.py files in the SymPy directory which match any of the given strings in ``paths`` or all tests if paths=[]. Notes: - Paths can be entered in native system format or in unix, forward-slash format. - Files that are on the blacklist can be tested by providing their path; they are only excluded if no paths are given. Examples ======== >>> import sympy Run all tests: >>> sympy.doctest() # doctest: +SKIP Run one file: >>> sympy.doctest("sympy/core/basic.py") # doctest: +SKIP >>> sympy.doctest("polynomial.rst") # doctest: +SKIP Run all tests in sympy/functions/ and some particular file: >>> sympy.doctest("/functions", "basic.py") # doctest: +SKIP Run any file having polynomial in its name, doc/src/modules/polynomial.rst, sympy/functions/special/polynomials.py, and sympy/polys/polynomial.py: >>> sympy.doctest("polynomial") # doctest: +SKIP The ``split`` option can be passed to split the test run into parts. The split currently only splits the test files, though this may change in the future. ``split`` should be a string of the form 'a/b', which will run part ``a`` of ``b``. Note that the regular doctests and the Sphinx doctests are split independently. For instance, to run the first half of the test suite: >>> sympy.doctest(split='1/2') # doctest: +SKIP The ``subprocess`` and ``verbose`` options are the same as with the function ``test()`` (see the docstring of that function for more information) except that ``verbose`` may also be set equal to ``2`` in order to print individual doctest lines, as they are being tested. c4|z rtd|z zSdSrrrs r/rzdoctest..~rr.rP_doctestrFrN)rrrrrs ` r/rrLsd6Mub"% A ! ;J&+VECe|3i-C!q&  5"b !ax1&122a1fJ r.cg}|jgdd}td|dzD]"}|jdt|zdz$|jgdt d|jgd n4t d |jd d gnd dl}|j dts t d|jdgt d|jddgt d|jdgt d|jdgt d|jddgt d|jdgt d|jddgt d|jddg|jgd|jdg|jgd t|}|S)!z*Get the default blacklist for the doctests)zdoc/src/modules/plotting.rstz4doc/src/modules/physics/mechanics/autolev_parser.rstzsympy/codegen/array_utils.pyzsympy/core/compatibility.pyzsympy/core/trace.pyzsympy/galgebra.pyz,sympy/parsing/autolev/_antlr/autolevlexer.pyz/sympy/parsing/autolev/_antlr/autolevlistener.pyz-sympy/parsing/autolev/_antlr/autolevparser.pyz(sympy/parsing/latex/_antlr/latexlexer.pyz)sympy/parsing/latex/_antlr/latexparser.pyz%sympy/plotting/pygletplot/__init__.pyz!sympy/plotting/pygletplot/plot.pyzsympy/printing/ccode.pyzsympy/printing/cxxcode.pyzsympy/printing/fcode.pyzsympy/testing/randtest.pyz sympy/this.py rQz,sympy/parsing/autolev/test-examples/ruletestz.py)zKsympy/parsing/autolev/test-examples/pydy-example-repo/mass_spring_damper.pyzGsympy/parsing/autolev/test-examples/pydy-example-repo/chaos_pendulum.pyzHsympy/parsing/autolev/test-examples/pydy-example-repo/double_pendulum.pyzIsympy/parsing/autolev/test-examples/pydy-example-repo/non_min_pendulum.pynumpyN) z'sympy/plotting/experimental_lambdify.pyzsympy/plotting/plot_implicit.py)examples/advanced/autowrap_integrators.py&examples/advanced/autowrap_ufuncify.pyzexamples/intermediate/sample.py examples/intermediate/mplot2d.py examples/intermediate/mplot3d.py'doc/src/modules/numeric-computation.rstz%doc/src/explanation/best-practices.mdzFdoc/src/tutorials/physics/biomechanics/biomechanical-model-example.rstz7doc/src/tutorials/physics/biomechanics/biomechanics.rst matplotlibrrrAggpygletzsympy/plotting/pygletplotaesarazsympy/printing/aesaracode.pyrcupyjaxantlr4z!sympy/parsing/autolev/__init__.pyz)sympy/parsing/latex/_parse_latex_antlr.pylfortranzsympy/parsing/sym_expr.pyscipyz+doc/src/guides/solving/solve-numerically.mdz#doc/src/guides/solving/solve-ode.md)zsympy/utilities/autowrap.pyrrzsympy/conftest.py)zsympy/utilities/tmpfiles.pyzsympy/utilities/pytest.pyzsympy/utilities/runtests.pyz"sympy/utilities/quality_unicode.pyzsympy/utilities/randtest.py) rrrZrr ruserr`)rnumrrs r/_get_doctest_blacklistrs9I * C As1u ZG#a&PSXXYZ cd W%    & .   22   NN5 ! h'/567X& * 5  V$ 5  U# 5  X& / 7  Z ( '  W% 9 1  W%5=     ( 2I r.c  ddlm}ddlm}|j dd}|j dd}|j dd}|j d d}|j d g}|j d d } |j t td dd l} | jddd l } d| jj_ d| jj_ddlm} | t#|| ||} t%| |}|j'd}|j |j'dd|Dcgc]t)fd|Ds}}t+|dk(r|}n]t-|}g}|D]Kt.j0j3}|D]%}|vs t5||s|j7KM|j9| r t;|| }|j<j ||j<r|j? }nd}|j'ddd}|j'ddd}||z}|j9|Dcgc]t)fd|Ds}}t+|dk(r|}nRg}|D]Kt.j0j3}|D]%}|vs t5||s|j7KM| r t;|| }d}|D]}t.j0jA|s$tBjD} tG\}}tI|ddtJjLtJjNztJjPz}|tB_"dd l)m*cm+}d|_,||||_-|\}} | s|xs|}|r>d}d}!|j<s| j]|!n| j_|!ta||jcdt+dzdzd }"ta|"d| jdt+|"z dz }#d | z}$d |xsd!z}%tad"jg|$d|#t+|$z t+|%z z|%g|s|rtatad#ti|Scc}wcc}w#|tB_"dd l)m*cm+}d|_,||_-wxYw)$a( Internal function that actually runs the doctests. All keyword arguments from ``doctest()`` are passed to this function except for ``subprocess``. Returns 0 if tests passed and 1 if they failed. See the docstrings of ``doctest()`` and ``test()`` for more information. rrkrmnormalFrrTrrrVNrr) unset_show)rVrrrr) init_onlyc3&K|]}|v ywrr-rs r/rz_doctest..Arrzdoc/srcz*.rstz*.mdc3&K|]}|v ywrr-rs r/rz_doctest..krrutf-8)module_relativeencodingrBzrst/md doctests start)msgrQr6)endz[%s]OKr)5rqrlrtrngetrrr rr sympy.externalexternal importtoolsWARN_OLD_VERSIONWARN_NOT_INSTALLEDsympy.plotting.plotrr SymPyDocTestsrrrr`rSrTrrrZrrrrHisfilerW displayhookr{ sympytestfilepdoctestELLIPSISNORMALIZE_WHITESPACEIGNORE_EXCEPTION_DETAILrprrrsrurvstart write_centerrrYterminal_widthrUr)&rrrlrnrrrrrrVrrrrrrrrrrrfailedtest_files_rst test_files_md first_reportrst_fileold_displayhookryrzrGrx rstfailedtestedrfile_idwid test_filereports& ` r/rrs@0 ZZ% (FjjE*G ZZ$ 'F::ne4L ;+I ZZ &E +-.\".u27ENN/49ENN1/LweF$0 2Aa A!!'*Ja&&zU&CD",>Q!!<)!<<>O> 5zQ!(.  Aww''*H 6WXq1NN1%   LLN We,LL  ||VVX%%iE%JN$$Y%$HM-/JOO",>Q!!<)!<<>O> 5zQ!   Aww''*H 6WXq1NN1%   We,L)ww~~h' // :/;~ , n%'$--0M0MM0012C.CO F E-2 * / 0+9J ( 6 (&F$ -||GGG$NN3'Gx}}W5G DqHIJG 's #""S\1A5C&)Iy0D1F "''Cs9~!5F !CDfMO O)\ F   ! v;e>T>F.CO F E-2 * / 0+9J (s R:5R?>A S,S0z([0-9]+)/([1-9][0-9]*)ctj|}|s tdtt|j \}}s&||dz t |z|z|t |z|zSt}Dcgc]}||z  c}fd}||dz |z } |||z } |t | t |zt | t |zScc}w)a Splits a list into part a of b split should be a string of the form 'a/b'. For instance, '1/3' would give the split one of three. If the length of the list is not divisible by the number of splits, the last split will have more items. `density` may be specified as a list. If specified, tests will be balanced so that each split has as equal-as-possible amount of mass according to `density`. >>> from sympy.testing.runtests import split_list >>> a = list(range(10)) >>> split_list(a, '1/3') [0, 1, 2] >>> split_list(a, '2/3') [3, 4, 5] >>> split_list(a, '3/3') [6, 7, 8, 9] z=split must be a string of the form a/b where a and b are intsrQc|dkry|tk\ryd}tD]\}}||z }||k\sn||z z |z }|ztz S)zXInterpolate the inverse to the cumulative distribution function given by densityrrQ)sum enumerater)xcummrdfracrs r/ density_invzsplit_list..density_invsw 6 G g& DAq AIDqy TAX!#DCL((r.)spmatch ValueErrormaprgroupsrr=) lrVrmrrtotr?rC lower_frac higher_fracs ` r/rrs. A XYY sAHHJ DAq !a%Q"Qs1vXq[11 g,C '(1q3w(G)$a!eq[)Ja!e$K SCF" #c+c!f*<&= >>-)s< C) namedtupleSymPyTestResultszfailed attemptedc |r |s tdtj|||| \} }|tjj |}|i}n|j }||j|d|vrd|d<| rtj||} nt||} t| _ | j| |||d}| j||r| jtj | t_ntjj!| t#| j$| j&S)a Test examples in the given file. Return (#failures, #tests). Optional keyword arg ``module_relative`` specifies how filenames should be interpreted: - If ``module_relative`` is True (the default), then ``filename`` specifies a module-relative path. By default, this path is relative to the calling module's directory; but if the ``package`` argument is specified, then it is relative to that package. To ensure os-independence, ``filename`` should use "/" characters to separate path segments, and should not be an absolute path (i.e., it may not begin with "/"). - If ``module_relative`` is False, then ``filename`` specifies an os-specific path. The path may be absolute or relative (to the current working directory). Optional keyword arg ``name`` gives the name of the test; by default use the file's basename. Optional keyword argument ``package`` is a Python package or the name of a Python package whose directory should be used as the base directory for a module relative filename. If no package is specified, then the calling module's directory is used as the base directory for module relative filenames. It is an error to specify ``package`` if ``module_relative`` is False. Optional keyword arg ``globs`` gives a dict to be used as the globals when executing examples; by default, use {}. A copy of this dict is actually used for each docstring, so that each docstring's examples start with a clean slate. Optional keyword arg ``extraglobs`` gives a dictionary that should be merged into the globals that are used to execute examples. By default, no extra globals are used. Optional keyword arg ``verbose`` prints lots of stuff if true, prints only failures if false; by default, it's true iff "-v" is in sys.argv. Optional keyword arg ``report`` prints a summary at the end when true, else prints nothing at the end. In verbose mode, the summary is detailed, else very brief (in fact, empty if all tests passed). Optional keyword arg ``optionflags`` or's together module constants, and defaults to 0. Possible values (see the docs for details): - DONT_ACCEPT_TRUE_FOR_1 - DONT_ACCEPT_BLANKLINE - NORMALIZE_WHITESPACE - ELLIPSIS - SKIP - IGNORE_EXCEPTION_DETAIL - REPORT_UDIFF - REPORT_CDIFF - REPORT_NDIFF - REPORT_ONLY_FIRST_FAILURE Optional keyword arg ``raise_on_error`` raises an exception on the first unexpected exception or failure. This allows failures to be post-mortem debugged. Optional keyword arg ``parser`` specifies a DocTestParser (or subclass) that should be used to extract tests from the files. Optional keyword arg ``encoding`` specifies an encoding that should be used to convert the file to unicode. Advanced tomfoolery: testmod runs methods of a local instance of class doctest.Tester, then merges the results into (or creates) global Tester instance doctest.master. Methods of doctest.master can be called directly too, if you want to do something unusual. Passing report=0 to testmod is especially useful then, to delay displaying a summary. Invoke doctest.master.summarize(verbose) when you're done fiddling. z8Package may only be specified for module-relative paths.r*__main__rrBr)rFr(_load_testfilerSrTrcopyupdate DebugRunnerSymPyDocTestRunnerSymPyOutputCheckerr@ get_doctestrun summarizemastermergerOfailurestries)filenamernamepackageglobsrr:rB extraglobsraise_on_errorparserrtextrunnerrHs r/r'r's)b+, ,,,'?H6ND( |ww) }  Z &j%%g;O#GM,.   dE41 =D JJt  f% FOOV\\ ::r.cJeZdZ d dZ d dZdZ d dZdZdZd dZ y) rNcT||_||_d|_t|_||_|j j |jg|_||ntj|_ |rt||_ nd|_ |rt||_ yd|_ y)Nr ) _post_mortemr_countrh _root_dir _reporterroot_dirrr_seedfloat_fast_threshold_slow_threshold)rFreporterrrrrrs r/__init__zSymPyTests.__init__ps' &! /!-T6==?  #(#8D #$D #(#8D #%D r.c |r|jjnA|rn>tj|jtj |j|j j|j|jD]} |j|||||||j jS#t$r'td|j jwxYw)z Runs the tests returning True if all tests pass, otherwise False. If sort=False run tests in random order.  interrupted by user) rrrrrrshufflerpr,r9rrfinish)rFrrrrrrs r/rHzSymPyTests.tests  OO "   KK # NN4?? + TZZ( A q$#_6 ~~$$&& % ,-%%' s C0C6c  ddlm}m mmm mm m m m m m }m }ddddddd d d d d G f dd|}||}|j|}||S)Nr) NodeTransformerCompareNameStoreLoadTupleAssignBinOpStrModAssertparsefix_missing_locationsz==z!=z>=iszis notinznot in) EqNotEqLtLtEGtGtEIsIsNotInNotInc , eZdZ f dZy).SymPyTests._enhance_asserts..Transformc  t|jrG|j}|jg|jz}t |Dcgc] \}}d|z }}}|Dcgc]}|}}|Dcgc]}|} }|} |} | g| } | d|j | dd} ddj |j Dcgc]}|jjc}zdz}|| }| ||j|j}| |gS|Scc}}wcc}wcc}wcc}w)Nz_%srrQz %s z %s)lineno col_offset) rrHleft comparatorsr>opsrU __class__r*rr)rFstmtcomparevaluesr_namesn names_store names_loadtargetvalueassign new_compareop msg_formatrrHrrrr~rrrrrrrs r/ visit_Assertz;SymPyTests._enhance_asserts..Transform.visit_Assertscdii1"iiG%ll^g.A.AAF4=f4EGDAqeaiGEG>C"EDEG$4"EK"ES>S:T8l+m!mpv!vJJj$&8QRC!+s4;;SWSbSbcD"D>)KH"E!C 9ms E"#E(>E-/ E2 N)r*r+r,r) rrrr~rrrrrrrs r/ Transformrs   r.r)astr}r~rrrrrrrrrrrvisit)rFsourcer}rrrtreenew_treerrrr~rrrrrrrs @@@@@@@@@@@r/_enhance_assertszSymPyTests._enhance_assertssz K K K KDD$dXX/    &V};$$T*$X..r.c. |j}g} di} fd} | 5} | j} |jr_| jD]Bj j ds#t fd|jDsBn  dddyddd|r |j } t ddd} t| | t%|xj&d z c_t)j*|j,| j/d d }|swg}| D]} | j d st1j2| | st1j4| | sF| | t7d rj8t7d rt1j:k(s|j=| | |r|D cgc]} t?| dd s| }} |jAdd}|tC|krqt1jD||rE|jG|} | D])}|d|d dfd}|jI|||d z }+n|d z }|tC|krq|Dcgc]}|jK|s|}}|sy |jMtC||st)jN||D]} tQjP}|jS|  t?| dd r |s tUdtW5|r|jY| ||n&t)j*|j,| ddd|j[tQjP|z }||jrkDrWttjvjy|jz|j|j=dz| jlz|ft?| dd s/|s3||j~ksDttjvjy|jz|jj=dz| jlz|f|jy#1swYxYw#t$rYwxYw#ttf$rt$r'|jtjYyt $r'|j#tjY:wxYwcc} wcc}w#t $r|jMtC|wxYw#1swYxYw#t$r$t?| dd r|j]dnYt $r|rt_j`dtj\}}}|tbur6|je|||f|jfrtijj|n|jldk(r|j]|nv|jldk(r|jonV|jldk(r|jq|n5|j#|||f|jfrtijj|YwxYw)NrcctdS)Nr>)r)open)r`sr/rz&SymPyTests.test_file..sDF$Cr.zdef c3~K|]4}jj|jdk76yw)rPN)lowerrY)rkrIs r/rz'SymPyTests.test_file..s+&Y1qwwy~~aggi'@B'F&Ys:=execrT)flags dont_inheritrQdisabledFtest_ __wrapped___slowc2tj|dSNrQ)inspectgetsourcelinesr?s r/rz&SymPyTests.test_file..s)?)?)B1)Er.keycSrr-)argsfuncsr/rz&SymPyTests.test_file..s $+r.Slowrr(XFailXPassr)Brpreadr splitlineslstrip startswithrr ImportErrorcompiler SystemExitr import_errorrWexc_info Exceptiontest_exceptionr rnrrrrrr isfunctionismethodhasattrr getsourcefilerZgetattrrrisgeneratorfunctionpopinsertmatchesentering_filenamerztime entering_testr(r_timeout test_pass test_skipsignalalarmAssertionError test_failrmrrr* test_xfail test_xpassrurSrTrelpathroslow_test_functionsrtfast_test_functionsleaving_filename)rFr`rrrrrrvfuncsgl open_filerrcoderrfgfgwr?r,rvtrtakenrrrIs ` @@@r/r9zSymPyTests.test_files>>K h'B 8C [#AVVXFxx!'!2!2!4#A xxz44V<#&&YPTPXPX&Y#Y$)# #####!%!6!6v!>vxqtTT2 M KK1 K KK #vvj%0H 0A W-73E3Ebe3L"++BqE2!!u%dM:#'#3#3D&dM:#006(B!LLA/ 0(-L1GU1KQLEL E F#e*n2258<"IIaL"###B#%a5D#%ab6D"5C!LLC0FA #Q#e*n%*=qT\\!_== ""8SZ8 NN5 !. ?AIIKE  " "1 %! %1gu-d!&/)(* a/B DJJ/ <""$IIK%'Et+++77??8X5G5GH,,33_qzz159;q'5)d4///!wwx9K9KLH0077!D1::5u=?[. ?^ !!#w##'  12  %%h ? 8'' 7 8.M$>   & &xU <   % 1gu-&&':;< ,LLO<<>1b&&&1bz2((+ZZ9,&&q)ZZ7*'')ZZ7*''*++Q2J7((+# ,sT! R'AR 5R R R'! R',R=R'A+T!0T!6)T! T!9T!T(T,BT!T!TT!T!$U)=U &U RR' R$ R'#R$$R''.callbackHs- LLO"#?'#IJJi((r.r)rSIGALRMr)rFrrrrs `` r/rzSymPyTests._timeoutGs8 )  fnnh/ W  Qr.c|jsy|jD]>}|jjj|jdk7s>yy)z Does the keyword expression self._kw match "x"? Returns True/False. Always returns True if self._kw is "". TrPF)rr*rrY)rFr?rs r/rzSymPyTests.matchesSsO xx(( Bzz!&&rxxz2b8 r.c tjj|jt |gd}g}tj |D]P\}}}|j |Dcgc]/}t||stjj||1c}Rt|Dcgc]!}tjj|#c}Scc}wcc}w)z Returns the list of test_*.py (default) files at or below directory ``dir`` relative to the SymPy home directory. r) rSrTrUror`walkrrsortedr[) rFdirpatgrTfoldersfilesrgis r/rzSymPyTests.get_test_files`s ggll4>>+BC5+I!+LM $&GGCL P D'5 HHUNgaobggll4+N O Pa8rww''+899O8s%C 7"C +&C)rFNNN)FFFFF)TFFFF)z test_*.py) r*r+r,rwrHrr9rrrr-r.r/rrns?49@D&24938'2/>BG38D$L   :r.rc8eZdZdZdZdZddZ ddZy) r$cd|_t|_||_|jj |j||_g|_y)Nr)rnrhrorprq_normalr)rFrvrs r/rwzSymPyDocTests.__init__ps= &! / r.c|jj|jD]} |j||jj S#t$r't d|jj wxYw)zU Runs the tests and returns True if all tests pass, otherwise False. ry)rpr,rr9rrr{rFrs r/rHzSymPyDocTests.testysz  A q! ~~$$&& % ,-%%' s A0Bc$ tddlm}ddlmcm}ddlm}ddlm }|t|jdzd}tjj|\}}|jtj ddd} |j#dr%t$jj'd||dd} t)j*| } t-j/| } |j#drt$jd= | D cgc]} t| j<dkDs| } } | j?d | sy|j6jA|t| | D] } t| j<dk7sJ|j6jBr4|j6jEd jG| jHd | jJvr |jLdi| jJd tU|j6jBdk(t(jVt(jXzt(jZz} t]| _/t$j`}|j6jBdk(r|n|}|t$_0|jbsi| _%t$jd}tg\}} | ji| |jDd\}} |t$_0|dkDr6|j6jk| jH|jm|j6jo|t$_2d|_8||||_9 |j6juy#t0t2f$rt4$rT|j6j9|t%j:Y|j#drt$jd=yywxYw#|j#drt$jd=wwxYwcc} w#tN$r0} |j6jQtS|  Yd} ~ d} ~ wwxYw#t2$rwxYw#|t$_0wxYw)Nr)StringIOrkrmrQ.rc|j Sr)rrs r/rz)SymPyDocTests.test_file..s !((r.rz {} _doctest_depends_on)rrRF)rG clear_globsr-);r iorrprrrsrqrlrtrnrrorSrTrVreplaceseprrWrr(_normalize_moduleSymPyDocTestFinderrYrrrrprrrrr_verbosewriteformatrarc_check_dependenciesr4rrrWr)r*r+rXr@rrr&r{rZ doctest_failgetvaluerrurvr)rFr`rrxrlrnrel_namerdfiler~testsrHerholdnewr4ryrzrrs r/r9zSymPyDocTests.test_files AAC4C/!345 h/ !!"&&#.s3   z * HHOOAw '#2YF //7F&(--f5E"":.HHQK"'B$3t}}+=+ABB  * +  ((3u:>2 >Dt}}%* **~~&&$$W^^DII%>?% 2,D,,Qtzz:O/PQ (0G0G0J ( 1 111!244!56F12FO**C00!3#CCJ<< "ooO/;~ , n !zz$&)iiU"D1 ! 1u++DIIs||~F((*"116$."#34/= ,e2 >h '')Q-.    NN ' '#,,. A "":.HHQK/  "":.HHQK/C*'NN,,s1v,6:%  ! sa=.NP31P3+P8!Q4AP"P PP %P08 Q1%Q,,Q14 Q??R Rc d}tjj|jt |gd}g}tj |D]`\}}}|j |D cgc]?} | jds,t| |r tjj|| Ac} b|r|D cgc] } || s | }} |D cgc]!} tjj| #c} Scc} wcc} wcc} w)a Returns the list of \*.py files (default) from which docstrings will be tested which are at or below directory ``dir``. By default, only those that have an __init__.py in their parent directory and do not start with ``test_`` will be included. ctjjtjj|d}tjj |S)aN Checks if given pathname x is an importable module by checking for __init__.py file. Returns True/False. Currently we only test if the __init__.py file exists in the directory with the file "x" (in theory we should also test all the parent dirs). z __init__.py)rSrTrUrdexists)r?init_pys r/ importablez0SymPyDocTests.get_test_files..importables8ggll277??1#5}EG77>>'* *r.rr) rSrTrUror`rrrrr[) rFrr rr0r rTr r rr?r s r/rzSymPyDocTests.get_test_filess +ggll4>>+BC5+I!+LM $&GGCL I D'5 HHUH\\'2wq#ggll4+H I I /qA/A//01  $11 H01s(AC< ; D D&DNc |D]%}tj|rtd|z|D]F}|dk(r&tddgdidtf}|#tdt|r:td |z|rt j } | d tjd tjd <d } |D]} ttjj| | j| tjtjj| | tjtj ztj"z|r>t$j&|kr+td djt)t*|z|t,|vrtdt+|zd|vr ddl} Gdd} | | j0_yy)z Checks if the dependencies for the test are installed. Raises ``DependencyError`` it at least one dependency is not installed. zCould not find %srfromlist)pyplotcm collectionsz1.0.0) import_kwargsmin_module_versioncatchNzCould not import matplotlibzCould not import %srOPATHzZ#!/usr/bin/env python3 import sys if len(sys.argv) <= 1: exit("wrong number of args") zRequires Python >= rzRequires ground_types in rrc*eZdZdZdZdZdZdZy)6SymPyDocTests._check_dependencies..DummyWindowc.d|_d|_d|_y)NTiXi)has_exitwidthheight)rFrrs r/rwz?SymPyDocTests._check_dependencies..DummyWindow.__init__@s$(DM!$DJ"%DKr.cyrr-rFr?s r/ set_vsyncz@SymPyDocTests._check_dependencies..DummyWindow.set_vsyncEr.cyrr-rFs r/ switch_toz@SymPyDocTests._check_dependencies..DummyWindow.switch_toHrCr.cyrr-rAs r/ push_handlerszDSymPyDocTests._check_dependencies..DummyWindow.push_handlersKrCr.cyrr-rEs r/closez.DummyWindow.closeNrCr.N)r*r+r,rwrBrFrHrJr-r.r/ DummyWindowr;?s& r.rK)shutilwhichr4r RuntimeErrortempfilemkdtemprSrr rTrU write_textchmodstatS_IREADS_IWRITES_IXUSRrW version_inforGrr rwindowWindow)rF executablesmodulesdisable_viewerspython_version ground_types executabler~rtempdirvwviewerrrKs r/r#z!SymPyDocTests._check_dependenciess& HJ<< +%&9J&FGG H JF%* #-&E#G'.|o G %)*GHH$V,)*?&*HII J &&(G,3RZZ5G!HBJJv 7B * FRWW\\'623>>rBgv6 5 DF  F .0%&;chhs3P^G_>`&`aa  #</%&AC DU&UVV w    $$/FMM - r.)z*.pyT)r-r-r-)N)r*r+r,rwrHr9rr#r-r.r/r$r$ns0 '\*|2D)+$&,.+1)- K/r.r$ceZdZdZdZdZy)ra; A class used to extract the DocTests that are relevant to a given object, from its docstring and the docstrings of its contained objects. Doctests can currently be extracted from the following object types: modules, functions, classes, methods, staticmethods, classmethods, and properties. Modified from doctest's version to look harder for code that appears comes from a different module. For example, the @vectorize decorator makes it look like functions come from multidimensional.py even though their code exists elsewhere. c |jrtd|zt||vryd|t|<tj|r"|j j dddk7ry|j|||||}||j||jsytj|r|jjD]\} } tj| stj| s1| j |jk7rK|j|| sJ| d|d| d  |d| } |j!|| | ||||t%|d ijD]\} } t'| t(st+d t-| tj| sftj| sQtj.| s &!(Z < B B D ( !'3/$&*7m&677 **3/7??33G((-1A1A#1F"3,$'+3i&233/3G< 5#w  $( ($ ??3  # 2 2 4 , c<0!#w/Cc;/!#w/88C''s 4,"31%%fc2"#x0"388\:"xx22fooE (>>V__<$,,VS92229*.w7GJJuc7FL$d,9 , --s N>> O cd}t|trB|}tjd|}t |dk(s Jd|zt |ddd}n,t |dd}|d}t|ts t|}|jr|syt|tr|jjy|nt|}t|d r&|j|jdj} nt|tr |j} n|} |j| |}|y|d} n#t |d |j } | d dd vr| dd } t |di|d<|j"j%|||| |S)zs Return a DocTest for the given object, if it defines a docstring; otherwise, return None. Nzline \d+rQz$string '%s' does not contain lineno rrd__doc__r func_closurerc)z.pycz.pyorPr)rrr7findallrrr_exclude_emptyrvrwr~rrr cell_contents _find_linenor*_parserrY) rFrxrar~rcryr docstringrtobjr`s r/rkzSymPyDocTestFinder._get_tests  c3  Ijjd3Gw<1$ >6= >$ AB(F Y3I  i- N    y c8 $xx' >+CsN+0@0@0L''*88C*xx&&t\:F > >Hvz6??CH} 00#CR='.s4I2'N#$||'' 5$(0&: :r.N)r*r+r,r~rqrkr-r.r/rrTs `,DF:r.rceZdZdZddZy)rWa A class used to run DocTest test cases, and accumulate statistics. The ``run`` method is used to process a single DocTest case. It returns a tuple ``(f, t)``, where ``t`` is the number of test cases tried, and ``f`` is the number of test cases that failed. Modified from the doctest version to not reset the sys.displayhook (see issue 5140). See the docstring of the original DocTestRunner for more information. Nc8||_|jD]R}|jjdd|_|jxr|jjdd|_T|t j |j}tj}| |j}|jt_ tj}t j||_|jj!|jjt_ t j"j$|_|j(t"_t+5 |j-||||t_ |t_ |j&t"_|r|jj/cdddS#|t_ |t_ |j&t"_|r|jj/wwxYw#1swYyxYw)af Run the examples in ``test``, and display the results using the writer function ``out``. The examples are run in the namespace ``test.globs``. If ``clear_globs`` is true (the default), then this namespace will be cleared after the test runs, to help with garbage collection. If you would like to examine the namespace after the test completes, then use ``clear_globs=False``. ``compileflags`` gives the set of flags that should be used by the Python compiler when running the examples. If not specified, then it will default to the set of future-import flags that apply to ``globs``. The output of each example is checked using ``SymPyDocTestRunner.check_output``, and the results are formatted by the ``SymPyDocTestRunner.report_*`` methods. z``` rN)rHrwantrexc_msgr(_extract_future_flagsrcrWrr!_fakeoutr set_trace_OutputRedirectingPdbdebuggerreset linecachegetlinessave_linecache_getlines/_SymPyDocTestRunner__patched_linecache_getlinesr_SymPyDocTestRunner__runclear)rFrH compileflagsrGrrI save_stdoutsave_set_traces r/rZzSymPyDocTestRunner.runs( }} WG"<<//> ! " ' 'zz$ c:( . %)%A%A "JJ$$& ' ') . %)%A%A "JJ$$& ' 's&H G2AHA H  HH)NNT)r*r+r,r~rZr-r.r/rWrW s  ='r.rW)patched_linecache_getlinesrZrecord_outcome_DocTestRunner___SymPyDocTestRunner__ceZdZdZdZdZy)rXz Compared to the OutputChecker from the stdlib our OutputChecker class supports numerical comparison of floats occurring in the output of the doctest examples cd}|dz}d}|dz}d|d|d}d|d |d|d}tjd |d |d |_d|d|d}d|d |d|d}tjd |d |d |_y) Nz(\d+\.\d*|\.\d+)z(\.{3})?z \s|\+|\-|\*|,z|j|e^z(?=z|$)z(?<=rg(|)r7r num_got_rgx num_want_rgx)rF got_floats want_floats front_sepback_sepfbegfmidends r/rwzSymPyOutputChecker.__init__ms|) !;. $ w&!+X6*3ZJ::4&AB!,h7*3[(KJJD''BCr.cD||k(ry|jj|}|Dcgc]}|jd}}|jj|}|Dcgc]}|jd}}t |t |k7ryt |dkDrg}t ||D]Q\} } d| vr|j | |j | tt| t| z dkDsQy|jjd|}|t|z}|tjzsXtjdtjtjzd |}tjd d |}||k(ry|tj zrDd j#|j%}d j#|j%}||k(ry|tj&zrtj(||ryycc}wcc}w) a Return True iff the actual output from an example (`got`) matches the expected output (`want`). These strings are always considered to match if they are identical; but depending on what option flags the test runner is using, several non-exact match types are also possible. See the documentation for `TestRunner` for more information about option flags. TrQFrz...gh㈵>%sz (?m)^%s\s*?$rz (?m)^\s*?$r6)rfinditergrouprrziprZabsrsr8tupler(DONT_ACCEPT_BLANKLINEr7escapeBLANKLINE_MARKERr*rUrVr)_ellipsis_match) rFrrJrBrrE numbers_got numbers_wantnw_ngnws r/ check_outputzSymPyOutputChecker.check_outputs $; ""++C03:;%u{{1~; ;##,,T24;<5 A< < { s<0 0 { a Ck<8 !BB;JJrNJJrNuRyr*+d2  !""&&uc2Cc "Ch<<<66/BIIh6O6O,PPd$D&&C0Cd{ 66 6((399;'C88DJJL)Dd{ ** *''c2c<\d+);z(?P\d+)\s*columns;zcolumns\s+=\s+(?P\d+);columns)rWrXctypesrrkernel32 GetStdHandleGetConsoleScreenBufferInfostructunpackrawrrrrrrrrrDr7searchrrrFOSError)rrhcsbiresrrrrightprocessrrre_linuxre_osx re_solarisregexrErr>rFs r/findout_terminal_widthz=PyTestReporter.terminal_width..findout_terminal_widths||w& @OO005+B/oo@@DI! mTXX>=Q1aD!UAq! 4<'...szz8,SZZ5F5F5H*** )$**FD>%??%??,")!4!4!6w/:7? & ; )EIIeV4E("'++i"8!$'LE!A:#(L )&& & *! !+ 2&& &5 s% AF$3 F F! F!$ F;:F;)r)rFrr>s` r/r.zPyTestReporter.terminal_widths8    +'' '8 't'($ r.cjd}i}|D] \}} | ||< d} d} | |j}|dk(rY|jt|z|kDr|jd|jd||jz t|z z|js;t t jdr!t jjsd }n$t jd k(rd }n|jsd }|jr'|d dk7rt jjdtr"|jd jd d}nt jjj!j#dsQ|jt jjdjt jj}|d k(r t jj|n+t jj| ||z|| t jj%|j'd} | dk(r|xjt|z c_nt|| z dz |_|j|k\|_ |xj|zc_y)a Prints a text on the screen. It uses sys.stdout.write(), so no readline library is necessary. Parameters ========== color : choose from the colors below, "" means default color align : "left"/"right", "left" is a normal print, "right" is aligned on the right-hand side of the screen, filled with spaces if necessary width : the screen width ))Blackz0;30)Redz0;31)Greenz0;32)Brownz0;33)Bluez0;34)Purplez0;35)Cyanz0;36) LightGrayz0;37)DarkGrayz1;30)LightRedz1;31) LightGreenz1;32)Yellowz1;33) LightBluez1;34) LightPurplez1;35) LightCyanz1;36)Whitez1;37zz[%smNr r6rrrNrr=r>r?utfbackslashreplacerPrQ)r.rrr!rrrWrrrXrr IS_WINDOWSrCrDrrrflushrfind) rFrgcoloralignr>rcolor_templatesrrarc_normalc_colorrIs r/r!zPyTestReporter.write7s!" &* !KD% F4L ! =''E G T*U2 4 JJsEDOO3c$i?@ A!!gcjj(&C !!# E \\W $EE ??Aw$   & ;;34;;FHMD$$**,77>;;szz224F &szz':': ;  B; JJ  T " JJ  6%=($: ;  JJt  7 OOs4y (O!$i!ma/DO//U2 5 r.c|j}|dk7rd|z}|t|z dz}||z|z|||z t|z zz}|j|dzy)Nrz %s rr)r.rr!)rFrgdelimr>idxrs r/r-zPyTestReporter.write_centerse## 2:D=Ds4y Q& #I ueckCI&=> > 1t8r.c|j}tj|||}|jdj |y)Nr)tb_next tracebackformat_exceptionr!rU)rFr)rrrs r/write_exceptionzPyTestReporter.write_exceptions3 ZZ  & &q#r 2 2771:r.c |j|tj}ttj}d|z}t j }|dk(r|dtjzz }|jd|d|d|ddd l m }|jd |zdd l m }|jd |zd } tdk(rddl} | j} |jdtd| dt!d} |jd| sdn | j"z||jd|zddl m} |jdt'j(dxsd} | r%| dk(s t+| r|jd| zn|jd|j,r|jd|j,z|jdt/|_y)Nz%s.%s.%s-%s-%sPyPyz %s.%s.%s-%s-%szexecutable: z (z) [z] r)ARCHzarchitecture: %s ) USE_CACHEzcache: %s rgmpyzground types: r6rrznumpy: %s zrandom seed: %d )HASH_RANDOMIZATIONzhash randomization: r0rzon (PYTHONHASHSEED=%s) zoff zsplit: %s )r-rWr_rrWrXpython_implementationpypy_version_infor!sympy.utilities.miscrsympy.core.cacherr gmpy2versionr __version__rrSrrrclock_t_start)rFrrr_rr]implementationrrr rrrrs r/r,zPyTestReporter.starts #^^ #"" #)A-!779 V # /#2G2GG GN 9 :- -45. - 9: & llnG L'JKg& -UHYHYZ[   JJ1D8 9; )*II./63 9#8C N JJ1I= > JJw  ;; JJ1DKK? @ 4 r.c t_jddjzat tafd}t jdkDr|dt jzt jdkDr|dt jzjdkDr|djzjdkDr|djzt jdkDr|dt jzt jdkDr|d t jz|d jjz zjrDjd d t!jd }|D]\}}t#d||fzj$rDjdd t!j$d}|D]\}}t#d||fzt jdkDrQjdd jD]}j|dd|dd!jdj&dk7rt jdkDr|jD]\}|\}} \} } } jdd | d|z} n|d| j(} j| d j+| | | ^jdj&dk7rt jdkDrrjD]R}|\}} \} } } jdd j|d| j(d j+| | | Tjdj&dk7rwt jdkDr_jD]?}|\}}jdd jd|zd j|Ajdjtt jdk(xr2t jdk(xrt jdk(}|sjd|S)Nrztests finished: %d passed, c tt|zjkDr tdz adat|z att|z ay)Nrr)linelenrr.rg)mytextrFs r/add_textz'PyTestReporter.finish..add_textsB -V$t':'::  FND s6{ "Gr.rz %d failed, z %d skipped, z%d expected to fail, z %d expected to fail but passed, z%d exceptions, zin %.2f secondsz slowest testsrc |dSrr-rs r/rz'PyTestReporter.finish..s 1r.rz%s - Took %.3f secondszunexpectedly fast testsc |dSrr-r+s r/rz'PyTestReporter.finish..s qtr.z xpassed testsz: rQnorrrOrzDO *NOT* COMMIT! )r"_t_endr!rrgrr'rrrrrrr#rr-rrrrr*r)rFr) sorted_slowslow_func_namer sorted_fastfast_func_namer)r`rrrrr9roks` r/r{zPyTestReporter.finishsGg  4,t||;d) # t|| q ]S%66 7 t## $q ( ]S)=)=%>> ? ==1  ^dmm3 4 ==1  ,t}}< = t}}  ! 7#dmm:LL M t 1 $ &T-=-=)>> ?"dkkDMM&ABC  # #   os 3 !9!9~NK)4 J%..%1HHI J  # #   7 = !9!9%35K)4 J%..%1HHI J t}}  !   os 3]] 6 1qt45 6 JJt  >>T !c$*:*:&;a&?%% 1,-)!\ab!!"c*9xA#+QZZ8A!!!S)$$QR0 1 JJt  >>T !c$,,&7!&;\\ 1,-)!\ab!!"c*!!h "CSI$$QR0  1 JJt  >>T !c$*>*>&?!&C))  ! #!!"c*!!$/37 3  JJt  $  ! #+D,<,<(=(B+ $$ % *  JJ+ , r.c|t|jdzd}||_d|_|j ||j d|zy)NrQFz[%d] )rror_active_file_errorr!)rFr`rr&s r/rz PyTestReporter.entering_filename sIC/!345$"' 8 7Q;r.c|jd|jr|jdddn|jddd|jd|jr|jdyy) Nr6[FAIL]rrrz[OK]rr)r!r5r rEs r/rzPyTestReporter.leaving_filename s^ 3  " " JJxgJ 6 JJvwgJ 6 4 == JJt  r.cn||_|jr"|jd|jzdzyy)Nrr6)rr r!r*rs r/rzPyTestReporter.entering_test' s/ == JJtajj(3. / r.cR|xjdz c_|jddy)NrQrr)rr!rEs r/rzPyTestReporter.test_xfail, s   3 r.ct|}|jj|j|f|j ddy)NXr)rrrZrr!)rFrmessages r/rzPyTestReporter.test_xpass0 s6a& d//9: 3 r.c|jj|j|j|f|j ddd|_y)NFrT)rrZrrr!r5rFrs r/rzPyTestReporter.test_fail5 s; T..IJ 3"&r.cdj|jddd}|jj||f|j ddd|_y)NrrQr?rT)rUrVrrZr!r5)rFra error_msgs r/r$zPyTestReporter.doctest_fail: sOIIiood3AB78  ##T9$56 3"&r.c|xjdz c_|jr|jddy|j|dy)NrQr3r)rr r!)rFchars r/rzPyTestReporter.test_passA s3  == JJtW % JJtW %r.c d}|xjdz c_|"t|}|dk(rd}n|dk(rd}n|dk(rd}|jr*||jd zd n|jd d |j|d y) Nr9rQrKrTrwr6rz - )rrr r!)rFrrDr=s r/rzPyTestReporter.test_skipH s  =!fG--I%F" ==} 7S=&1 5&) 4 r.c|jj|j|j|f|dtur|j ddd|_y|j ddd|_y)NrrGrET)rrZrrr2r!r5r@s r/rzPyTestReporter.test_exceptionZ sc !2!2DNNH MN A;, & JJsE "#' JJsE ""&r.c(|jj|d|f|t|jdzd}|j ||j dd|j d|j ddd|j dy) NrQz[?] Failed to importrr6r7rr8r)rrZrror!)rFr`rr&s r/rzPyTestReporter.import_errorb s| 4 :;C/!345 8 +U3 3 8U' 2 4r.)FrTFN)rrNF)=)Nztest process starts)rr)r*r+r,r~rwrqrvr.r!r-rr,r{rrrrrrr$rrrrr-r.r/rrs:>+/ 8AAF9= X!t ! FRh 0 !! ' '&!$'r.r))T)r-Nr-Nr-Nr)Rr~rSrWrXrrrr7rrrtimeitrr"rr(rrrrrLrrSrOr contextlibrrpathlibr rr rr sympy.external.gmpyr rarrrrrrr(r2r4r;rKreport_failurer`rhr{rr_rrrHrrrrrDrr5rNrO DocTestParserr'rr$rrWmonkeypatched_methodsmethodoldnamenewnamesetattrr OutputCheckerrXrrr-r.r/rZsx    )0  %((,ggo  $** *S i  9  i / 1#2M &',.  !#cnn'uYx-126487t!dP'ddD%E5RD JKZ $1GT|~]~RZZ)*7?r#02DE,0tTdU*H**,ty;x}:}:@c/c/Lv:v:rJ'J'\ $JF 6)G%.G )HIJ _//_D  ZXZr.