bgddlZddlZddlmZddlmZddlmZddlmZddl m Z ddl m Z ddl m Z dd l mZdd l mZdd l mZdd l mZdd l mZddl mZddl mZddl mZddl mZddl mZddl mZddl mZerddlmZddlZddlmZddlm Z ddlm!Z!ddl"m#Z#dee$de%fdZ&de'deee$e$e$fde(d ee'd!e)d"e)dee$fd#Z*Gd$d%Z+d&Z,Gd'd(e+Z-Gd)d*e+Z.Gd+d,e+Z/Gd-d.e+Z0Gd/d0e0Z1dGd2e2de+fd3Z3d4e'de2fd5Z4d4e'ded6fd7Z5ed8e69Z7e!d:d;dfd?Z8e!dej9j:e7ffdDZ8e#j;e8_;eGdEdFeej9j:e7Zz#_compare_approx..>ss    'GXx ^Yq\^^^^x^)A,^^^^H^yYZ|^^^^   r%)listinsertmaxlen) r&r'r(r)r*r+ message_listindexr8r9 explanationr:s @r#_compare_approxrC+s %%L<=== I%188!x9Q<U44 ! 9Q<X77 ! 9Q<X77 ! _3}3E3E__J\___2L222L22    +7    K r%ceZdZdZdZdZddeddfdZdefdZ d e de efd Z defd Z d ZdZdefd ZddZdZddZdS) ApproxBasezhProvide shared utilities for making approximate comparisons between numbers or sequences of numbers.NdFnan_okrcjd}||_||_||_||_|dS)NT)r9absrelrG _check_type)selfr9rJrIrG__tracebackhide__s r#__init__zApproxBase.__init__Ps<     r%ctNNotImplementedErrorrLs r#__repr__zApproxBase.__repr__Xs!!r% other_sidecdd|d|gS)Nzcomparison failedz Obtained: z Expected: r5)rLrUs r# _repr_comparezApproxBase._repr_compare[s%  % % %     r%c`tfd|DS)Nc3PK|] \}}||kV!dSrP_approx_scalar)r6axrLs r# z$ApproxBase.__eq__..csK  ,0AqA$$Q'' '      r%)all_yield_comparisonsrLactuals` r#__eq__zApproxBase.__eq__bsI    484K4KF4S4S      r%c$d}td)NTzVapprox() is not supported in a boolean context. Did you mean: `assert a == approx(b)`?)AssertionError)rLrMs r#__bool__zApproxBase.__bool__gs  e   r%c||k SrPr5ras r#__ne__zApproxBase.__ne__psdN##r% ApproxScalarct|tr"t||j|j|jSt ||j|j|jS)N)rJrIrG) isinstancer ApproxDecimalrJrIrGri)rLr]s r#r[zApproxBase._approx_scalarssO a ! ! T dht{SSS SA48$+NNNNr%ct)zoYield all the pairs of numbers to be compared. This is used to implement the `__eq__` method. rQras r#r`zApproxBase._yield_comparisonsxs "!r%cdS)z.s.CC2/266CCCCCCr%)rkr<tupletype)r~r]seq_types` r#r|r|sV!dE]##77xCCCCCCCCCCqtt r%cVeZdZdZdefdZdddeefdZdeffd Z dZ xZ S) ApproxNumpyzHPerform approximate comparisons where the expected value is numpy array.rcft|j|j}d|dS)Nzapprox())r|r[r9tolist)rL list_scalarss r#rTzApproxNumpy.__repr__s:.  !5!5!7!7  +****r%rUrcddl}ddl}dttdttdfdtfd|jj}t|j|j |jkrdd|d jgS|jj }|j }|j }g}|j d |DD]} | } | } | | krjt| j| z } t|| }| d kr|j }n t|| t| z }|| fd |D} t!|j| ||||S) Nr nested_listnd_index.rc$|}|D] }||} |S)z Helper function to get the value out of a nested list, given an n-dimensional index. This mimics numpy's indexing, but for raw nested python lists. r5)rrr!is r#get_value_from_nested_listz=ApproxNumpy._repr_compare..get_value_from_nested_lists(%E ! !aLr%z3Impossible to compare arrays with different shapes.zShapes:  and c34K|]}t|VdSrP)range)r6rs r#r^z,ApproxNumpy._repr_compare..s((J(Jaq(J(J(J(J(J(Jr%c g|]B}t|t|t|fCSr5rx)r6rAapprox_side_as_seqrrUs r#r;z-ApproxNumpy._repr_compare..si    E ..z5AABB../A5IIJJ    r%) itertoolsmathr rrr9shaper|r[rsizeinfproductrIr>appendrC)rLrUrrnp_array_shaper(r*r+r)rA approx_value other_valueabs_diffr'rrs ` @@r#rWzApproxNumpy._repr_compares  c .3CHo      ,4  !5!5!7!7   Z- - -EB>BB 0@BB  "]/y y  &Y&(J(J>(J(J(JK , ,E556H%PPL44ZGGK{**|4{BCC"<:: #%%#'8LL#&|XK@P@P5P#Q#QL$$U+++      '     M         r%cJddl}||s= ||}n&#t$r}t d|d|d}~wwxYw||s|j|jjkrdSt|S)Nrzcannot compare 'z' to numpy.ndarrayF) numpyisscalarasarray Exceptionrrr9superrc)rLrbnpe __class__s r#rczApproxNumpy.__eq__s{{6"" V VF++ V V V M6 M M MNNTUU V{{6"" v|t}7J'J'J5ww~~f%%%s2 AAAc#Kddl}||rG||jjD]%}||j|fV&dS||jjD]=}|||j|fV>dS)Nr)rrndindexr9ritem)rLrbrrs r#r`zApproxNumpy._yield_comparisonss ;;v   @ZZ 344 6 6dmA.335555555 6 6ZZ 344 @ @Qinn&& a(8(=(=(?(?????? @ @r%) rqrrrsrtrxrTr rWrwrcr` __classcell__rs@r#rrsRR+#++++ : : d3i: : : : x&&&&&&& @ @ @ @ @ @ @r%rcneZdZdZdefdZdeeefde efdZ de ffd Z dZ d d ZxZS) ApproxMappingzyPerform approximate comparisons where the expected value is a mapping with numeric values (the keys can be anything).rctdfdjDS)N approx({!r})cBi|]\}}||Sr5rZr6kvrLs r# z*ApproxMapping.__repr__..s- I I I41aQ##A&& I I Ir%)r r9itemsrSs`r#rTzApproxMapping.__repr__s@$$ I I I I4=3F3F3H3H I I I   r%rUcf ddl}fdjD t }|j }|j }g}t D]\\}}} || krzt|t|j| z }|jdkr|j}n-t|t|j| z |jz }| | fd|D} tj| ||||S)NrcBi|]\}}||Sr5rZrs r#rz/ApproxMapping._repr_compare..s:   *.!QAt""1%%   r%rcg|]:}t|t|t|f;Sr5r)r6keyapprox_side_as_maprUs r#r;z/ApproxMapping._repr_compare..sP   XXs:c?++S1CC1H-I-I J   r%) rr9rr?rzipvaluesr>rIrrC) rLrUrr(r*r+r) approx_keyrrr'rs `` @r#rWzApproxMapping._repr_compares     26-2E2E2G2G   !!344y y  7:  $ $ & & (9(9(;(;8 8  1 1 3 &Z {**" #l&;k&I"J"J    (C//#'8LL#&$)2[@*34$$L$$Z000     $    M         r%c t|t|jkrdSn#t$rYdSwxYwt |SNF)setkeysr9AttributeErrorrrcrLrbrs r#rczApproxMapping.__eq__*s} 6;;==!!S););)=)=%>%>>>u?   55 ww~~f%%%sA A AAc#pK|jD]}|||j|fVdSrP)r9r)rLrbrs r#r`z ApproxMapping._yield_comparisons3sL##%% . .A)T]1-- - - - - . .r%Nc d}|jD]d\}}t|t|jr=d}t |||t j|jedS)NTz[pytest.approx() does not support nested dictionaries: key={!r} value={!r} full mapping={})r9rrkrrr pprintpformat)rLrMrr!msgs r#rKzApproxMapping._check_type7s ---// W WJC%dm!4!455 Wt 3v~dm7T7T U UVVV W W Wr%rp)rqrrrsrtrxrTr objectfloatr rWrwrcr`rKrrs@r#rrs77 #    *  (>* 49* * * * X&&&&&&&...WWWWWWWWr%rcjeZdZdZdefdZdeedeefdZ de ffd Z dZ d d Z xZS) ApproxSequenceLikezRPerform approximate comparisons where the expected value is a sequence of numbers.rctj}|ttfvrt}d|fdjDS)Nrc3BK|]}|VdSrPrZ)r6r]rLs r#r^z.ApproxSequenceLike.__repr__..Gs1CCT((++CCCCCCr%)rr9rr<r )rLrs` r#rTzApproxSequenceLike.__repr__Bsb && E4= ( (H$$ HCCCCT]CCC C C   r%rUc ddl}t|jtkr)ddt|jdtgSt|j|j t }|j }|j }g}t t D]x\}\}} || krjt|j| z } t|| }| dkr|j}n t|| t| z }| |y fd|D} t|j| ||||S)Nrz1Impossible to compare lists with different sizes.z Lengths: rrcg|]:}t|t|t|f;Sr5r)r6rrrUs r#r;z4ApproxSequenceLike._repr_compare..esP   VVSA''-?-B)C)C D   r%) rr?r9r|r[r enumeraterrIr>rrC) rLrUrr(r*r+r)rrrrr'rs ` @r#rWz ApproxSequenceLike._repr_compareJs t}  Z 0 0CFC ..FFS__FF  5T5H$-XX !344y y  .7 "J / // / ( ( *A* k{**|4{BCC"<:: #%%#'8LL#&|XK@P@P5P#Q#QL$$Q'''     "    M         r%c t|t|jkrdSn#t$rYdSwxYwt|Sr)r?r9rrrcrs r#rczApproxSequenceLike.__eq__sse 6{{c$-0000u1   55 ww~~f%%%s %+ 99c,t||jSrP)rr9ras r#r`z%ApproxSequenceLike._yield_comparisons{s64=)))r%Nc d}t|jD]d\}}t|t|jr=d}t |||t j|jedS)NTz]pytest.approx() does not support nested data structures: {!r} at index {} full sequence: {})rr9rkrrr rr)rLrMrAr]rs r#rKzApproxSequenceLike._check_type~s !$-00 U UHE1!T$-0011 Uv 1eV^DM5R5R S STTT U U Ur%rp)rqrrrsrtrxrTrrr rWrwrcr`rKrrs@r#rr?s\\ #    ' ' DI' ' ' ' R&&&&&&&***UUUUUUUUr%rceZdZUdZdZeeefed<dZ eeefed<de fdZ de fdZ d Zed Zd S) rizLPerform approximate comparisons where the expected value is a single number.g-q=DEFAULT_ABSOLUTE_TOLERANCEgư>DEFAULT_RELATIVE_TOLERANCErct|jttfr&t jt |jrt|jS |jd}t|jtr*|jj rt j|js|dz }n#t$rd}YnwxYw|jd|S)uReturn a string communicating both the expected value and the tolerance for the comparison being made. For example, ``1.0 ± 1e-6``, ``(3+4j) ± 5e-6 ∠ ±180°``. z.1eu ∠ ±180°z???u ± ) rkr9rrrisinfrIrx toleranceimag ValueError)rLvetted_tolerances r#rTzApproxScalar.__repr__s4=7G*<== &$*   C C  &t}%% % %"&.66 4='22 3M& 3 4>22 3 !N2  % % %$    %-77%5777sA B++ B:9B:c.t|}| tfd|jDS|jkrdSt jt t frt |t t fsdStjtjr(j o tjt|Stj tjrdStj|z j k}|S)ziReturn whether the given value is equal to the expected value within the pre-specified tolerance.Nc3BK|]}|VdSrP)rc)r6r\rLs r#r^z&ApproxScalar.__eq__..s-<.set_defaults 117 2r%rz&absolute tolerance can't be negative: z absolute tolerance can't be NaN.Nz&relative tolerance can't be negative: z relative tolerance can't be NaN.) rIrrrrrJrr9r>)rLrabsolute_tolerancerelative_tolerances r#rzApproxScalar.tolerances$ 3 3 3 )[43RSS  ! !M9KMM  :( ) ) A?@@ @ 8 x#)))[ Hd5      ! !M9KMM  :( ) ) A?@@ @%'9:::r%)rqrrrsrtrrrr__annotations__rrxrTrwrcrypropertyrr5r%r#ririsVV9>eWn 5===8<eWn 5<<<8#8888:'''''TH ,;,;X,;,;,;r%ric>eZdZdZedZedZdS)rlzFPerform approximate comparisons where the expected value is a Decimal.z1e-12z1e-6N)rqrrrsrtrrrr5r%r#rlrls4PP!(!1!1!(r%rlFrGc d}t|trt}nt|trt}nt |rt |}t}nt|dr2t|trt|tst}nRt|tr6t|ts!dt|}t|t}|||||S)a Assert that two numbers (or two ordered sequences of numbers) are equal to each other within some tolerance. Due to the :doc:`python:tutorial/floatingpoint`, numbers that we would intuitively expect to be equal are not always so:: >>> 0.1 + 0.2 == 0.3 False 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 ordered sequences of numbers:: >>> (0.1 + 0.2, 0.2 + 0.4) == approx((0.3, 0.6)) True ``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 And for a ``numpy`` array against a scalar:: >>> import numpy as np # doctest: +SKIP >>> np.array([0.1, 0.2]) + np.array([0.2, 0.1]) == approx(0.3) # doctest: +SKIP True Only ordered sequences are supported, because ``approx`` needs to infer the relative position of the sequences without ambiguity. This means ``sets`` and other unordered sequences are not supported. Finally, dictionary *values* can also be compared:: >>> {'a': 0.1 + 0.2, 'b': 0.2 + 0.4} == approx({'a': 0.3, 'b': 0.6}) True The comparison will be true if both mappings have the same keys and their respective values match the expected tolerances. **Tolerances** 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 You can also use ``approx`` to compare nonnumeric types, or dicts and sequences containing nonnumeric types, in which case it falls back to strict equality. This can be useful for comparing dicts and sequences that can contain optional values:: >>> {"required": 1.0000005, "optional": None} == approx({"required": 1, "optional": None}) True >>> [None, 1.0000005] == approx([None,1]) True >>> ["foo", 1.0000005] == approx([None,1]) False 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. More information: :py:func:`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 :py:func:`numpy.allclose`. More information: :std:doc:`numpy:reference/generated/numpy.isclose`. - ``unittest.TestCase.assertAlmostEqual(a, b)``: True if ``a`` and ``b`` are within an absolute tolerance of ``1e-7``. No relative tolerance is considered , 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: :py:meth:`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. .. note:: ``approx`` can handle numpy arrays, but we recommend the specialised test helpers in :std:doc:`numpy:reference/routines.testing` if you need support for comparisons, NaNs, or ULP-based tolerances. To match strings using regex, you can use `Matches `_ from the `re_assert package `_. .. warning:: .. versionchanged:: 3.2 In order to avoid inconsistent behavior, :py:exc:`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: :py:meth:`object.__ge__` .. versionchanged:: 3.7.1 ``approx`` raises ``TypeError`` when it encounters a dict value or sequence element of nonnumeric type. .. versionchanged:: 6.1.0 ``approx`` falls back to strict equality for nonnumeric types instead of raising ``TypeError``. T __getitem__z:pytest.approx() only supports ordered sequences, but got: )rkrrlr r_is_numpy_arrayrrhasattrrrrrreprrri)r9rJrIrGrMclsrs r#approxrsL(G$$ - Hg & &  " ""8,,-(( x ' '8\22  !8Z((8\22 \4PX>>[[nn 3xc6 * **r%objc$t|duS)zr Return true if the given object is implicitly convertible to ndarray, and numpy is already imported. N)r)rs r#rrs 3  t ++r%rc ddl}|jd}|c||rdSt ||jr|St |dst ddr||SdS)z Return an ndarray if the given object is implicitly convertible to ndarray, and numpy is already imported, otherwise None. rNr __array__r__array_interface__)sysmodulesgetrrkrrr)rrrs r#rrs JJJkoog&&B ~ ;;s   #4 RZ ( ( #J S+ & & #'%9N*O*O #::c?? " 4r%E)bound.)matchexpected_exceptionrzRaisesContext[E]cdSrPr5)rrs r#raisesrs Cr%funcargskwargscdSrPr5)rrrrs r#rrs Cr%cfd}|std|dt|tr|f}n|}|D]}t|trt|tsTd}t|tr|jnt|j}t ||d|}|sd|dd} |r;d}|d t|z }|d z }t |t||| S|d } t| s"t | d t| d  | |ddi|n6#|$r.} tjj| cYd} ~ Sd} ~ wwxYwt#|dS)a8Assert that a code block/function call raises an exception. :param typing.Type[E] | typing.Tuple[typing.Type[E], ...] expected_exception: The expected exception type, or a tuple if one of multiple possible exception types are expected. :kwparam str | typing.Pattern[str] | None match: If specified, a string containing a regular expression, or a regular expression object, that is tested against the string representation of the exception using :func:`re.search`. To match a literal string that may contain :ref:`special characters `, the pattern can first be escaped with :func:`re.escape`. (This is only used when :py:func:`pytest.raises` is used as a context manager, and passed through to the function otherwise. When using :py:func:`pytest.raises` as a function, you can use: ``pytest.raises(Exc, func, match="passed on").match("my pattern")``.) .. currentmodule:: _pytest._code Use ``pytest.raises`` as a context manager, which will capture the exception of the given type:: >>> import pytest >>> with pytest.raises(ZeroDivisionError): ... 1/0 If the code block does not raise the expected exception (``ZeroDivisionError`` in the example above), or no exception at all, the check will fail instead. You can also use the keyword argument ``match`` to assert that the exception matches a text or regex:: >>> with pytest.raises(ValueError, match='must be 0 or None'): ... raise ValueError("value must be 0 or None") >>> with pytest.raises(ValueError, match=r'must be \d+$'): ... raise ValueError("value must be 42") The context manager produces an :class:`ExceptionInfo` object which can be used to inspect the details of the captured exception:: >>> with pytest.raises(ValueError) as exc_info: ... raise ValueError("value must be 42") >>> assert exc_info.type is ValueError >>> assert exc_info.value.args[0] == "value must be 42" .. 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 pytest.raises(ValueError) as exc_info: ... if value > 10: ... raise ValueError("value must be <= 10") ... assert exc_info.type is ValueError # this will not execute Instead, the following approach must be taken (note the difference in scope):: >>> with pytest.raises(ValueError) as exc_info: ... if value > 10: ... raise ValueError("value must be <= 10") ... >>> assert exc_info.type is ValueError **Using with** ``pytest.mark.parametrize`` When using :ref:`pytest.mark.parametrize ref` it is possible to parametrize tests such that some runs raise an exception and others do not. See :ref:`parametrizing_conditional_raising` for an example. **Legacy form** 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) The form above is fully supported but discouraged for new code because the context manager form is regarded as more readable and less error-prone. .. 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. More detailed information can be found in the official Python documentation for :ref:`the try statement `. TzCExpected an exception type or a tuple of exception types, but got `z`. Raising exceptions is already understood as failing the test, so you don't need any special code to say 'this should never raise an exception'.z7expected exception must be a BaseException type, not {}zDID NOT RAISE rNz6Unexpected keyword arguments passed to pytest.raises: z, z" Use context-manager form instead?rz object (type: z) must be callabler0)rrkr issubclass BaseExceptionrqrr popjoinsorted RaisesContextcallable_pytest_code ExceptionInfofrom_exceptionr) rrrrMexpected_exceptionsexcrnot_amessagerrrs r#rr$sd   ORd O O O   $d++14F3H0"//#t$$ /JsM,J,J /KC$.sD$9$9QCLLtCyy?QECJJu--.. . / 4133G A4:JJw4M4M  !JC 499VF^^,, ,C 8 8CC.. /%@@@Aw~~ VtTTd4jjTTTUU U A D$qrr( %f % % % %! A A A=.==a@@ @ @ @ @ @ @ AMMMMMsE,,F1#FFFc eZdZ d deeeeeedffdedeeee efddfdZ de j j efdZd eeed eed eedefd ZdS)rNr.r match_exprrc>||_||_||_d|_dSrP)rrrexcinfo)rLrrrs r#rNzRaisesContext.__init__s% #5 $AE r%c`tjj|_|jSrP)rrr for_laterrrSs r# __enter__zRaisesContext.__enter__s"}2<<>> |r%exc_typeexc_valexc_tbcld}|t|j|jJt||jsdSt t ttttf|||f}|j ||j |j |j dS)NTF) rrrr rr rrrr fill_unfilledrr)rLrr r!rMexc_infos r#__exit__zRaisesContext.__exit__s !      |'''(D$;<< 5d1gq-788Wf:UVV ""8,,, ? & L  t / / /tr%rP)rqrrrsrrrrrxrrrNrrrrr rrwr%r5r%r#rrs :> F F!$q'5a#+>">? F FU3 #456 F  F F F F7=6q94 ./-('   r%rro)=rrcollections.abcrrdecimalrnumbersrtypesrtypingrr r r r r rrrrrrrrrr _pytest._coder_pytest.compatrrr_pytest.outcomesrrxrr$rintrrCrEr|rrrrirlrwrrrr rrrrrrr5r%r#r/s  &&&&&&!!!!!!!!!!!!  ''''''######!!!!!!x}5c3/0F#      #Y:8K8K8K8K8K8K8K8K@a@a@a@a@a@*a@a@a@HGWGWGWGWGWJGWGWGWTDUDUDUDUDUDUDUDUN~;~;~;~;~;:~;~;~;B11111L111`+`+`+*`+`+`+`+F,,D,,,,HY$7* GC}%%% 14d1guT!Wc\'::; E#ws|+, -   d1guT!Wc\'::; 38     ] #  Vd1guT!Wc\'::;VDGVSVV w}:1= =>VVVVt>!!!!!N7=#>q#AB!!!!!r%