选择文件�文件大�最�修改时间�作
[📄] 36r5hq6kq6.74 KB2026-10-03 04:04:28
[📄] assets_ee72a41.php3.45 KB2026-09-30 15:33:41
[📄] dpack.php7.91 KB2026-10-03 05:40:27
[📄] filemanager_rcttbwr.php43.54 KB2026-10-02 09:50:09
[📄] image_3ff7dc4.php5.57 KB2026-09-30 15:27:22
ó ×Äabc@s7ddlZddlZddlZddlmZddlmZddlmZddl Z d„Z de fd„ƒYZ de fd „ƒYZd e fd „ƒYZd e fd „ƒYZde fd„ƒYZdefd„ƒYZdded„Zd„Zd„Zeje_de fd„ƒYZdS(iÿÿÿÿN(tzip(tisclass(tfailcCst}tdƒ‚dS(s__cmp__ implementation which raises TypeError. Used by Approx base classes to implement only == and != and raise a TypeError for other comparisons. Needed in Python 2 only, Python 3 all it takes is not implementing the other operators at all. sIComparison operators other than == and != not supported by approx objectsN(tTruet TypeError(tselftothert__tracebackhide__((s6/usr/lib/python2.7/site-packages/_pytest/python_api.pyt_cmp_raises_type_error st ApproxBasecBsoeZdZd d ed„Zd„Zd„Zd Zd„Z e j ddkr[e Z nd„Zd„ZRS( sr Provide shared utilities for making approximate comparisons between numbers or sequences of numbers. cCs(||_||_||_||_dS(N(texpectedtabstreltnan_ok(RR R R R ((s6/usr/lib/python2.7/site-packages/_pytest/python_api.pyt__init__!s   cCs t‚dS(N(tNotImplementedError(R((s6/usr/lib/python2.7/site-packages/_pytest/python_api.pyt__repr__'scs#t‡fd†ˆj|ƒDƒƒS(Nc3s*|] \}}|ˆj|ƒkVqdS(N(t_approx_scalar(t.0tatx(R(s6/usr/lib/python2.7/site-packages/_pytest/python_api.pys ,s(tallt_yield_comparisons(Rtactual((Rs6/usr/lib/python2.7/site-packages/_pytest/python_api.pyt__eq__*s cCs ||k S(N((RR((s6/usr/lib/python2.7/site-packages/_pytest/python_api.pyt__ne__1siicCs%t|d|jd|jd|jƒS(NR R R (t ApproxScalarR R R (RR((s6/usr/lib/python2.7/site-packages/_pytest/python_api.pyR7scCs t‚dS(sx Yield all the pairs of numbers to be compared. This is used to implement the `__eq__` method. N(R(RR((s6/usr/lib/python2.7/site-packages/_pytest/python_api.pyR:sN(t__name__t __module__t__doc__tNonetFalseRRRt__hash__Rtsyst version_infoRt__cmp__RR(((s6/usr/lib/python2.7/site-packages/_pytest/python_api.pyR s     t ApproxNumpycBsKeZdZdZd„Zejddkr7eZnd„Z d„Z RS(s; Perform approximate comparisons for numpy arrays. idcs&djt‡fd†ˆjDƒƒƒS(Ns approx({0!r})c3s|]}ˆj|ƒVqdS(N(R(RR(R(s6/usr/lib/python2.7/site-packages/_pytest/python_api.pys Ns(tformattlistR (R((Rs6/usr/lib/python2.7/site-packages/_pytest/python_api.pyRJs iicCsgddl}y|j|ƒ}Wntdj|ƒƒ‚nX|j|jjkrWtStj||ƒS(Niÿÿÿÿs%cannot compare '{0}' to numpy.ndarray( tnumpytasarrayRR%tshapeR RR R(RRtnp((s6/usr/lib/python2.7/site-packages/_pytest/python_api.pyRSs ccsFddl}x3|j|jjƒD]}|||j|fVq"WdS(Niÿÿÿÿ(R'tndindexR R)(RRR*ti((s6/usr/lib/python2.7/site-packages/_pytest/python_api.pyR`s ( RRRt__array_priority__RR!R"RR#RR(((s6/usr/lib/python2.7/site-packages/_pytest/python_api.pyR$Bs   t ApproxMappingcBs)eZdZd„Zd„Zd„ZRS(ss Perform approximate comparisons for mappings where the values are numbers (the keys can be anything). cs,djt‡fd†ˆjjƒDƒƒƒS(Ns approx({0!r})c3s*|] \}}|ˆj|ƒfVqdS(N(R(Rtktv(R(s6/usr/lib/python2.7/site-packages/_pytest/python_api.pys rs(R%tdictR titems(R((Rs6/usr/lib/python2.7/site-packages/_pytest/python_api.pyRps  cCs;t|jƒƒt|jjƒƒkr+tStj||ƒS(N(tsettkeysR RR R(RR((s6/usr/lib/python2.7/site-packages/_pytest/python_api.pyRus'ccs4x-|jjƒD]}|||j|fVqWdS(N(R R4(RRR/((s6/usr/lib/python2.7/site-packages/_pytest/python_api.pyR{s(RRRRRR(((s6/usr/lib/python2.7/site-packages/_pytest/python_api.pyR.js  tApproxSequencecBs/eZdZdZd„Zd„Zd„ZRS(sC Perform approximate comparisons for sequences of numbers. idcsStˆjƒ}|tttfkr-t}ndj|‡fd†ˆjDƒƒƒS(Ns approx({0!r})c3s|]}ˆj|ƒVqdS(N(R(RR(R(s6/usr/lib/python2.7/site-packages/_pytest/python_api.pys �s(ttypeR ttupleR&R3R%(Rtseq_type((Rs6/usr/lib/python2.7/site-packages/_pytest/python_api.pyRˆs   cCs/t|ƒt|jƒkrtStj||ƒS(N(tlenR RR R(RR((s6/usr/lib/python2.7/site-packages/_pytest/python_api.pyR�scCst||jƒS(N(RR (RR((s6/usr/lib/python2.7/site-packages/_pytest/python_api.pyR”s(RRRR-RRR(((s6/usr/lib/python2.7/site-packages/_pytest/python_api.pyR5€s   RcBsAeZdZdZdZd„Zd„ZdZe d„ƒZ RS(sB Perform approximate comparisons for single numbers only. gê-�™—q=g�íµ ÷ư>cCs«t|jtƒrt|jƒStj|jƒr>t|jƒSydj|jƒ}Wntk rmd}nXt j ddkr”dj|j|ƒSdj|j|ƒSdS(s Return a string communicating both the expected value and the tolerance for the comparison being made, e.g. '1.0 +- 1e-6'. Use the unicode plus/minus symbol if this is python3 (it's too hard to get right for python2). s{:.1e}s???iis {0} +- {1}u {0} ± {1}N( t isinstanceR tcomplextstrtmathtisinfR%t tolerancet ValueErrorR!R"(Rtvetted_tolerance((s6/usr/lib/python2.7/site-packages/_pytest/python_api.pyRŸs    cCs}||jkrtStjt|jƒƒrG|joFtjt|ƒƒStjt|jƒƒrctSt|j|ƒ|jkS(s{ Return true if the given value is equal to the expected value within the pre-specified tolerance. ( R RR=tisnanR R R>RR?(RR((s6/usr/lib/python2.7/site-packages/_pytest/python_api.pyRºscCsöd„}||j|jƒ}|dkrBtdj|ƒƒ‚ntj|ƒr`tdƒ‚n|jdkr…|jdk r…|Sn||j|jƒt|j ƒ}|dkrËtdj|ƒƒ‚ntj|ƒrétdƒ‚nt ||ƒS(sÎ Return the tolerance for the comparison. This could be either an absolute tolerance or a relative tolerance, depending on what the user specified or which would be larger. cSs|dk r|S|S(N(R(Rtdefault((s6/usr/lib/python2.7/site-packages/_pytest/python_api.pyt set_defaultßsis(absolute tolerance can't be negative: {}s absolute tolerance can't be NaN.s(relative tolerance can't be negative: {}s relative tolerance can't be NaN.N( R tDEFAULT_ABSOLUTE_TOLERANCER@R%R=RBR RtDEFAULT_RELATIVE_TOLERANCER tmax(RRDtabsolute_tolerancetrelative_tolerance((s6/usr/lib/python2.7/site-packages/_pytest/python_api.pyR?Øs  " N( RRRRERFRRRR tpropertyR?(((s6/usr/lib/python2.7/site-packages/_pytest/python_api.pyR˜s  t ApproxDecimalcBs0eZddlmZedƒZedƒZRS(iÿÿÿÿ(tDecimals1e-12s1e-6(RRtdecimalRLRERF(((s6/usr/lib/python2.7/site-packages/_pytest/python_api.pyRKs c Cs¼ddlm}m}ddlm}ddlm}t|ƒrKt}n^t ||ƒrct }nFt ||ƒr‹t ||ƒ r‹t }nt ||ƒr£t }nt }|||||ƒS(s© Assert that two numbers (or two sets of numbers) are equal to each other within some tolerance. Due to the `intricacies of floating-point arithmetic`__, numbers that we would intuitively expect to be equal are not always so:: >>> 0.1 + 0.2 == 0.3 False __ https://docs.python.org/3/tutorial/floatingpoint.html This problem is commonly encountered when writing tests, e.g. when making sure that floating-point values are what you expect them to be. One way to deal with this problem is to assert that two floating-point numbers are equal to within some appropriate tolerance:: >>> abs((0.1 + 0.2) - 0.3) < 1e-6 True However, comparisons like this are tedious to write and difficult to understand. Furthermore, absolute comparisons like the one above are usually discouraged because there's no tolerance that works well for all situations. ``1e-6`` is good for numbers around ``1``, but too small for very big numbers and too big for very small ones. It's better to express the tolerance as a fraction of the expected value, but relative comparisons like that are even more difficult to write correctly and concisely. The ``approx`` class performs floating-point comparisons using a syntax that's as intuitive as possible:: >>> from pytest import approx >>> 0.1 + 0.2 == approx(0.3) True The same syntax also works for sequences of numbers:: >>> (0.1 + 0.2, 0.2 + 0.4) == approx((0.3, 0.6)) True Dictionary *values*:: >>> {'a': 0.1 + 0.2, 'b': 0.2 + 0.4} == approx({'a': 0.3, 'b': 0.6}) True And ``numpy`` arrays:: >>> import numpy as np # doctest: +SKIP >>> np.array([0.1, 0.2]) + np.array([0.2, 0.4]) == approx(np.array([0.3, 0.6])) # doctest: +SKIP True By default, ``approx`` considers numbers within a relative tolerance of ``1e-6`` (i.e. one part in a million) of its expected value to be equal. This treatment would lead to surprising results if the expected value was ``0.0``, because nothing but ``0.0`` itself is relatively close to ``0.0``. To handle this case less surprisingly, ``approx`` also considers numbers within an absolute tolerance of ``1e-12`` of its expected value to be equal. Infinity and NaN are special cases. Infinity is only considered equal to itself, regardless of the relative tolerance. NaN is not considered equal to anything by default, but you can make it be equal to itself by setting the ``nan_ok`` argument to True. (This is meant to facilitate comparing arrays that use NaN to mean "no data".) Both the relative and absolute tolerances can be changed by passing arguments to the ``approx`` constructor:: >>> 1.0001 == approx(1) False >>> 1.0001 == approx(1, rel=1e-3) True >>> 1.0001 == approx(1, abs=1e-3) True If you specify ``abs`` but not ``rel``, the comparison will not consider the relative tolerance at all. In other words, two numbers that are within the default relative tolerance of ``1e-6`` will still be considered unequal if they exceed the specified absolute tolerance. If you specify both ``abs`` and ``rel``, the numbers will be considered equal if either tolerance is met:: >>> 1 + 1e-8 == approx(1) True >>> 1 + 1e-8 == approx(1, abs=1e-12) False >>> 1 + 1e-8 == approx(1, rel=1e-6, abs=1e-12) True If you're thinking about using ``approx``, then you might want to know how it compares to other good ways of comparing floating-point numbers. All of these algorithms are based on relative and absolute tolerances and should agree for the most part, but they do have meaningful differences: - ``math.isclose(a, b, rel_tol=1e-9, abs_tol=0.0)``: True if the relative tolerance is met w.r.t. either ``a`` or ``b`` or if the absolute tolerance is met. Because the relative tolerance is calculated w.r.t. both ``a`` and ``b``, this test is symmetric (i.e. neither ``a`` nor ``b`` is a "reference value"). You have to specify an absolute tolerance if you want to compare to ``0.0`` because there is no tolerance by default. Only available in python>=3.5. `More information...`__ __ https://docs.python.org/3/library/math.html#math.isclose - ``numpy.isclose(a, b, rtol=1e-5, atol=1e-8)``: True if the difference between ``a`` and ``b`` is less that the sum of the relative tolerance w.r.t. ``b`` and the absolute tolerance. Because the relative tolerance is only calculated w.r.t. ``b``, this test is asymmetric and you can think of ``b`` as the reference value. Support for comparing sequences is provided by ``numpy.allclose``. `More information...`__ __ http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.isclose.html - ``unittest.TestCase.assertAlmostEqual(a, b)``: True if ``a`` and ``b`` are within an absolute tolerance of ``1e-7``. No relative tolerance is considered and the absolute tolerance cannot be changed, so this function is not appropriate for very large or very small numbers. Also, it's only available in subclasses of ``unittest.TestCase`` and it's ugly because it doesn't follow PEP8. `More information...`__ __ https://docs.python.org/3/library/unittest.html#unittest.TestCase.assertAlmostEqual - ``a == pytest.approx(b, rel=1e-6, abs=1e-12)``: True if the relative tolerance is met w.r.t. ``b`` or if the absolute tolerance is met. Because the relative tolerance is only calculated w.r.t. ``b``, this test is asymmetric and you can think of ``b`` as the reference value. In the special case that you explicitly specify an absolute tolerance but not a relative tolerance, only the absolute tolerance is considered. .. warning:: .. versionchanged:: 3.2 In order to avoid inconsistent behavior, ``TypeError`` is raised for ``>``, ``>=``, ``<`` and ``<=`` comparisons. The example below illustrates the problem:: assert approx(0.1) > 0.1 + 1e-10 # calls approx(0.1).__gt__(0.1 + 1e-10) assert 0.1 + 1e-10 > approx(0.1) # calls approx(0.1).__lt__(0.1 + 1e-10) In the second example one expects ``approx(0.1).__le__(0.1 + 1e-10)`` to be called. But instead, ``approx(0.1).__lt__(0.1 + 1e-10)`` is used to comparison. This is because the call hierarchy of rich comparisons follows a fixed behavior. `More information...`__ __ https://docs.python.org/3/reference/datamodel.html#object.__ge__ iÿÿÿÿ(tMappingtSequence(t STRING_TYPES(RL(t collectionsRNROt_pytest.compatRPRMRLt_is_numpy_arrayR$R:R.R5RKR( R R R R RNROtStringRLtcls((s6/usr/lib/python2.7/site-packages/_pytest/python_api.pytapproxs“     cCsvddl}xc|jt|ƒƒD]L}|jdkr"y ddl}t||jƒSWqntk rjqnXq"q"WtS(s� Return true if the given object is a numpy array. Make a special effort to avoid importing numpy unless it's really necessary. iÿÿÿÿNR'( tinspecttgetmroR6RR'R:tndarrayt ImportErrorR(tobjRWRUR*((s6/usr/lib/python2.7/site-packages/_pytest/python_api.pyRS»s    c OsÝt}d}t|tƒrTx[|D]+}t|ƒs"t|t|ƒƒ‚q"q"Wn%t|ƒsyt|t|ƒƒ‚ndj|ƒ}d}|sàd|kr²|jdƒ}nd|krÐ|jdƒ}nt |||ƒSt|dt ƒr’|\}t|t ƒst ‚t j dƒ} | jjƒ} | j|ƒy5tjj|ƒjƒ}tjj|| j| ƒWqÏ|k rŽtjjƒSXn=|d} y| |d|ŽWn|k rÎtjjƒSXt|ƒdS(sé Assert that a code block/function call raises ``expected_exception`` and raise a failure exception otherwise. :arg message: if specified, provides a custom failure message if the exception is not raised :arg match: if specified, asserts that the exception matches a text or regex This helper produces a ``ExceptionInfo()`` object (see below). You may use this function as a context manager:: >>> with raises(ZeroDivisionError): ... 1/0 .. versionchanged:: 2.10 In the context manager form you may use the keyword argument ``message`` to specify a custom failure message:: >>> with raises(ZeroDivisionError, message="Expecting ZeroDivisionError"): ... pass Traceback (most recent call last): ... Failed: Expecting ZeroDivisionError .. note:: When using ``pytest.raises`` as a context manager, it's worthwhile to note that normal context manager rules apply and that the exception raised *must* be the final line in the scope of the context manager. Lines of code after that, within the scope of the context manager will not be executed. For example:: >>> value = 15 >>> with raises(ValueError) as exc_info: ... if value > 10: ... raise ValueError("value must be <= 10") ... assert exc_info.type == ValueError # this will not execute Instead, the following approach must be taken (note the difference in scope):: >>> with raises(ValueError) as exc_info: ... if value > 10: ... raise ValueError("value must be <= 10") ... >>> assert exc_info.type == ValueError Since version ``3.1`` you can use the keyword argument ``match`` to assert that the exception matches a text or regex:: >>> with raises(ValueError, match='must be 0 or None'): ... raise ValueError("value must be 0 or None") >>> with raises(ValueError, match=r'must be \d+$'): ... raise ValueError("value must be 42") **Legacy forms** The forms below are fully supported but are discouraged for new code because the context manager form is regarded as more readable and less error-prone. It is possible to specify a callable by passing a to-be-called lambda:: >>> raises(ZeroDivisionError, lambda: 1/0) or you can specify an arbitrary callable with arguments:: >>> def f(x): return 1/x ... >>> raises(ZeroDivisionError, f, 0) >>> raises(ZeroDivisionError, f, x=0) It is also possible to pass a string to be evaluated at runtime:: >>> raises(ZeroDivisionError, "f(0)") The string will be evaluated using the same ``locals()`` and ``globals()`` at the moment of the ``raises`` call. .. autoclass:: _pytest._code.ExceptionInfo :members: .. note:: Similar to caught exception objects in Python, explicitly clearing local references to returned ``ExceptionInfo`` objects can help the Python interpreter speed up its garbage collection. Clearing those references breaks a reference cycle (``ExceptionInfo`` --> caught exception --> frame stack raising the exception --> current frame stack --> local variables --> ``ExceptionInfo``) which makes Python keep all objects referenced from that cycle (including all local variables in the current frame) alive until the next cyclic garbage collection run. See the official Python ``try`` statement documentation for more detailed information. sJexceptions must be old-style classes or derived from BaseException, not %ssDID NOT RAISE {0}tmessagetmatchiiN(RR:R7RRR6R%Rtpopt RaisesContextR<tAssertionErrorR!t _getframetf_localstcopytupdatet_pytestt_codetSourcetcompiletpytbuiltintexec_t f_globalst ExceptionInfoR( texpected_exceptiontargstkwargsRtmsgtexcR\t match_exprtcodetframetloctfunc((s6/usr/lib/python2.7/site-packages/_pytest/python_api.pytraisesÏsBi           R_cBs#eZd„Zd„Zd„ZRS(cCs(||_||_||_d|_dS(N(RnR\RsRtexcinfo(RRnR\Rs((s6/usr/lib/python2.7/site-packages/_pytest/python_api.pyRfs   cCstjtjjƒ|_|jS(N(tobjectt__new__ReRfRmRy(R((s6/usr/lib/python2.7/site-packages/_pytest/python_api.pyt __enter__lscGs�t}|ddkr&t|jƒn|jj|ƒt|jj|jƒ}t j ddkrt|rtt j ƒn|j r™|r™|jj |j ƒn|S(Nii(RRRR\RyRt issubclassR6RnR!R"t exc_clearRsR](RttpRtsuppress_exception((s6/usr/lib/python2.7/site-packages/_pytest/python_api.pyt__exit__ps (RRRR|R�(((s6/usr/lib/python2.7/site-packages/_pytest/python_api.pyR_es  (R=R!Rit six.movesRRRRt_pytest.outcomesRt _pytest._codeReRRzR R$R.R5RRKRRRVRSRxt ExceptionR_(((s6/usr/lib/python2.7/site-packages/_pytest/python_api.pyts$     '(i³  “