
    Ph|                        d Z ddlZddlZddlZddlZddlZddlZddlZddlZ	ddl
mZmZmZmZmZmZmZ ddlmZ 	 ddlZdZ G d d      Z G d	 d
e      Z G d de      Z G d de      Z G d de      Z G d de      Z G d d      Z G d de      Z G d de      Z G d de      Z  G d de      Z! G d de      Z" G d d e      Z# G d! d"e      Z$ G d# d$e      Z% G d% d&e      Z& G d' d(e      Z' G d) d*e      Z( G d+ d,e      Z) G d- d.e      Z* G d/ d0e      Z+ G d1 d2e      Z, G d3 d4e      Z- G d5 d6e      Z. G d7 d8e      Z/ G d9 d:e      Z0 G d; d<e      Z1 G d= d>e      Z2 G d? d@e      Z3 G dA dBe      Z4 e	jj                  dC      jl                   e	jj                  dC      jn                  dD dE dFZ8ejr                  ju                  dGe8jw                         e8H       G dI dJe             Z< G dK dLe      Z= G dM dNe      Z> G dO dPe      Z? G dQ dRe      Z@ G dS dTe      ZA G dU dVe      ZB G dW dXe      ZC G dY dZe      ZD G d[ d\e      ZEejr                  ju                  d]g d^      d_        ZFejr                  j                  d`       G da db             ZH G dc dde      ZI G de dfe      ZJ G dg dhe      ZKy# e$ r dZY w xY w)iz
Tests related to deprecation warnings. Also a convenient place
to document how deprecations should eventually be turned into errors.

    N)assert_raisesassert_warnsassert_assert_array_equalSkipTestKnownFailureExceptionbreak_cyclesfromstring_null_term_c_apiTFc                   T    e Zd ZdZeZd Zd Zdddej                  di fdZ
di fdZy	)
_DeprecationTestCase c                    t        j                  d      | _        | j                  j                         | _        t        j
                  d| j                         t        j
                  d| j                  | j                         y )NT)recordalways)categorymessager   )warningscatch_warningswarn_ctx	__enter__logfilterwarningswarning_clsr   selfs    mC:\Users\daisl\Desktop\realtime-object-detection\venv\Lib\site-packages\numpy/core/tests/test_deprecations.pysetup_methodz!_DeprecationTestCase.setup_method#   s_     //t<==**, 	43C3CD$,,)-)9)9	;    c                 8    | j                   j                          y N)r   __exit__r   s    r   teardown_methodz$_DeprecationTestCase.teardown_method1   s     r       F c                 r   d}g | j                   dd |t        j                  u r| j                  f}	  ||i | d}	| j                   D ]Q  }
|
j                  | j                  u r|	dz  }	!|r$t        d| j                  j                  d|
j                         |_|	|k7  rZdt        | j                         |fz  }| j                   D cg c]  }t        |       }}t        dj                  |g|z               t        j                         5  t        j                  d	| j                  | j                  
       	  ||i | |t               k7  rt        d      	 ddd       y# |rt        n	t               $ r Y Gw xY wc c}w # |$ r |t               k(  rt        d      Y Iw xY w# 1 sw Y   yxY w)a  Test if DeprecationWarnings are given and raised.

        This first checks if the function when called gives `num`
        DeprecationWarnings, after that it tries to raise these
        DeprecationWarnings and compares them with `exceptions`.
        The exceptions can be different for cases where this code path
        is simply not anticipated and the exception is replaced.

        Parameters
        ----------
        function : callable
            The function to test
        num : int
            Number of DeprecationWarnings to expect. This should normally be 1.
        ignore_others : bool
            Whether warnings of the wrong type should be ignored (note that
            the message is not checked)
        function_fails : bool
            If the function would normally fail, setting this will check for
            warnings inside a try/except block.
        exceptions : Exception or tuple of Exceptions
            Exception to expect when turning the warnings into an error.
            The default checks for DeprecationWarnings. If exceptions is
            empty the function is expected to run successfully.
        args : tuple
            Arguments for `function`
        kwargs : dict
            Keyword arguments for `function`
        TNr   r%   z	expected z
 but got: z"%i warnings found but %i expected.
errorr   z$No error raised during function callz!Error raised during function call)r   np_NoValuer   	Exceptiontupler   AssertionError__name__lenstrjoinr   r   r   r   )r   functionnumignore_othersfunction_fails
exceptionsargskwargs__tracebackhide__	num_foundwarningmsgwlsts                 r   assert_deprecatedz&_DeprecationTestCase.assert_deprecated4   s   B ! $**,J	d%f%
 	xxG4#3#33Q	"$))22G4D4DFG G	   ?yC/6#dhh-9MMC#'88,8a3q68C, C53;!788$$&##GT\\-1-=-=?A$)&)((BD D ) '&# ,	 		 -  A((?A A )A '&sG   E) F-F-? F
F-)FF
F*'F-)F**F--F6c                 B    | j                  |ddt               ||       y)zTest that warnings are not raised.

        This is just a shorthand for:

        self.assert_deprecated(function, num=0, ignore_others=True,
                        exceptions=tuple(), args=args, kwargs=kwargs)
        r   T)r4   r5   r7   r8   r9   N)r@   r-   )r   r3   r8   r9   s       r   assert_not_deprecatedz*_DeprecationTestCase.assert_not_deprecated}   s'     	xQd#(7f 	 	Fr    N)r/   
__module____qualname__r   DeprecationWarningr   r   r$   r*   r+   r@   rB   r&   r    r   r   r      sC     G$K;! /0u).%'[[!"GAR 46b 	Fr    r   c                   $    e Zd Zej                  Zy)_VisibleDeprecationTestCaseN)r/   rC   rD   r*   VisibleDeprecationWarningr   r&   r    r   rG   rG      s    ..Kr    rG   c                   ^    e Zd ZdZd Zej                  j                  e d      d        Z	y)TestDatetime64Timezonea{  Parsing of datetime64 with timezones deprecated in 1.11.0, because
    datetime64 is now timezone naive rather than UTC only.

    It will be quite a while before we can remove this, because, at the very
    least, a lot of existing code uses the 'Z' modifier to avoid conversion
    from local time to UTC, even if otherwise it handles time in a timezone
    naive fashion.
    c                     | j                  t        j                  d       | j                  t        j                  d       y )N)z2000-01-01T00+01r8   )z2000-01-01T00Z)r@   r*   
datetime64r   s    r   test_stringz"TestDatetime64Timezone.test_string   s2    r}}3HIr}}3FGr    z!The pytz module is not available.)reasonc                     t        j                  d      }t        j                  ddddd|      }| j                  t        j
                  |f       y )Nz
US/Easterni  r%   r   )tzinforL   )pytztimezonedatetimer@   r*   rM   )r   tzdts      r   test_datetimez$TestDatetime64Timezone.test_datetime   sE     ]]<(tQ1a;r}}B59r    N)
r/   rC   rD   __doc__rN   pytestmarkskipif	_has_pytzrW   r&   r    r   rJ   rJ      s>    H [[IB  D:D:r    rJ   c                       e Zd ZdZd Zy)+TestArrayDataAttributeAssignmentDeprecationaS  Assigning the 'data' attribute of an ndarray is unsafe as pointed
     out in gh-7093. Eventually, such assignment should NOT be allowed, but
     in the interests of maintaining backwards compatibility, only a Deprecation-
     Warning will be raised instead for the time being to give developers time to
     refactor relevant code.
    c                     t        j                  d      }t        j                  ddd      }d| _        | j	                  |j
                  d|j                  f       y )N
   r   r%   zcAssigning the 'data' attribute is an inherently unsafe operation and will be removed in the future.datarL   )r*   arangelinspacer   r@   __setattr__ra   )r   abs      r   test_data_attr_assignmentzETestArrayDataAttributeAssignmentDeprecation.test_data_attr_assignment   sL    IIbMKK1b!4 	q}}FAFF3CDr    N)r/   rC   rD   rX   rg   r&   r    r   r^   r^      s    Er    r^   c                       e Zd ZdZd Zd Zy)9TestBinaryReprInsufficientWidthParameterForRepresentationa  
    If a 'width' parameter is passed into ``binary_repr`` that is insufficient to
    represent the number in base 2 (positive) or 2's complement (negative) form,
    the function used to silently ignore the parameter and return a representation
    using the minimal number of bits needed for the form in question. Such behavior
    is now considered unsafe from a user perspective and will raise an error in the future.
    c                 b    d}ddi}d| _         | j                  t        j                  ||       y )N)r`   width   QInsufficient bit width provided. This behavior will raise an error in the future.r8   r9   r   r@   r*   binary_reprr   r8   r9   s      r    test_insufficient_width_positivezZTestBinaryReprInsufficientWidthParameterForRepresentation.test_insufficient_width_positive   2    1=r~~DHr    c                 b    d}ddi}d| _         | j                  t        j                  ||       y )N)rk   rl   rm   rn   ro   rq   s      r    test_insufficient_width_negativezZTestBinaryReprInsufficientWidthParameterForRepresentation.test_insufficient_width_negative   rs   r    N)r/   rC   rD   rX   rr   rv   r&   r    r   ri   ri      s    IIr    ri   c                       e Zd ZdZd Zy)$TestDTypeAttributeIsDTypeDeprecationz.*`.dtype` attributec                      G d d       G d dt         j                        | j                  fd       | j                  fd       | j                  fd       | j                  fd       y )	Nc                       e Zd ZdZy)ZTestDTypeAttributeIsDTypeDeprecation.test_deprecation_dtype_attribute_is_dtype.<locals>.dtf8Nr/   rC   rD   dtyper&   r    r   rV   r{      s    Er    rV   c                       e Zd ZdZy)[TestDTypeAttributeIsDTypeDeprecation.test_deprecation_dtype_attribute_is_dtype.<locals>.vdtzf,fNr}   r&   r    r   vdtr      s    Er    r   c                  .    t        j                         S r"   r*   r~   rV   s   r   <lambda>z`TestDTypeAttributeIsDTypeDeprecation.test_deprecation_dtype_attribute_is_dtype.<locals>.<lambda>   s    rxx|r    c                  8    t        j                                 S r"   r   r   s   r   r   z`TestDTypeAttributeIsDTypeDeprecation.test_deprecation_dtype_attribute_is_dtype.<locals>.<lambda>   s    rxx~r    c                  .    t        j                         S r"   r   r   s   r   r   z`TestDTypeAttributeIsDTypeDeprecation.test_deprecation_dtype_attribute_is_dtype.<locals>.<lambda>   s    rxx}r    c                  :    t        j                    d            S Nr%   r   r   s   r   r   z`TestDTypeAttributeIsDTypeDeprecation.test_deprecation_dtype_attribute_is_dtype.<locals>.<lambda>   s    rxxA'7r    )r*   voidr@   )r   rV   r   s    @@r   )test_deprecation_dtype_attribute_is_dtypezNTestDTypeAttributeIsDTypeDeprecation.test_deprecation_dtype_attribute_is_dtype   s[    	 		"'' 	 	34564578r    N)r/   rC   rD   r   r   r&   r    r   rx   rx      s    %G
9r    rx   c                       e Zd Zd Zy)TestTestDeprecatedc                     t               }|j                          t        t        |j                  d        d }|j	                  |       |j                          y )Nc                       y r"   r&   r&   r    r   r   z;TestTestDeprecated.test_assert_deprecated.<locals>.<lambda>   s    dr    c                  <    t        j                  dt        d       y )Nfoorl   )r   
stacklevel)r   warnrE   r&   r    r   r   z6TestTestDeprecated.test_assert_deprecated.<locals>.foo   s    MM%*<Kr    )r   r   r   r.   r@   r$   )r   test_case_instancer   s      r   test_assert_deprecatedz)TestTestDeprecated.test_assert_deprecated   sO    13'')n(::"	$	L 	,,S1**,r    N)r/   rC   rD   r   r&   r    r   r   r      s    -r    r   c                       e Zd ZdZd Zy)TestNonNumericConjugatez
    Deprecate no-op behavior of ndarray.conjugate on non-numeric dtypes,
    which conflicts with the error behavior of np.conjugate.
    c                 t   t        j                  d      t        j                  d      fD ]  }| j                  |j                          t        j                  d      t        j                  dd      t        j                  ddt        fdt        fg      fD ]  }| j                  |j                          y )	N   y              @s2016M)r%   rl   re   rf   )r*   arrayrB   	conjugateintr@   r   re   s     r   test_conjugatez&TestNonNumericConjugate.test_conjugate   s    !bhhrl*A&&q{{3 +((3-&#!63*sCj!9:<A""1;;/<r    N)r/   rC   rD   rX   r   r&   r    r   r   r      s    0r    r   c                       e Zd Zd Zy)TestNPY_CHARc                 X    ddl m} | j                  |       t         |       dk(         y )Nr   )npy_char_deprecationS1)numpy.core._multiarray_testsr   r@   r   )r   r   s     r   test_npy_char_deprecationz&TestNPY_CHAR.test_npy_char_deprecation   s%    E34$&$./r    N)r/   rC   rD   r   r&   r    r   r   r      s    0r    r   c                       e Zd Zd Zy)TestPyArray_AS1Dc                 0    ddl m} t        t        |       y )Nr   )npy_pyarrayas1d_deprecation)r   r   r   NotImplementedError)r   r   s     r    test_npy_pyarrayas1d_deprecationz1TestPyArray_AS1D.test_npy_pyarrayas1d_deprecation      L)+FGr    N)r/   rC   rD   r   r&   r    r   r   r         Hr    r   c                       e Zd Zd Zy)TestPyArray_AS2Dc                 0    ddl m} t        t        |       y )Nr   )npy_pyarrayas2d_deprecation)r   r   r   r   )r   r   s     r    test_npy_pyarrayas2d_deprecationz1TestPyArray_AS2D.test_npy_pyarrayas2d_deprecation
  r   r    N)r/   rC   rD   r   r&   r    r   r   r   	  r   r    r   c                       e Zd Zd Zy)TestDatetimeEventc                 2   t         j                  t         j                  fD ]t  }| j                  |d       | j                  |d       | j	                  |d       | j	                  |d       | j	                  |d       | j	                  |d       v y )N)r%   )msrl   rL   )r%   )r   rl   r%   N)r%   )r   rl   event)r%   )r   rl   ?   )r%   )r   rl   r%   r   )r%   )r   rl   r%   r   )r*   rM   timedelta64rB   r@   )r   clss     r   test_3_tuplezTestDatetimeEvent.test_3_tuple  s    MM2>>2C&&s&@&&s1H&I ""3-D"E""3-?"@""3-G"H""3-B"C 3r    N)r/   rC   rD   r   r&   r    r   r   r     s    Dr    r   c                       e Zd ZdZd Zd Zy)TestTruthTestingEmptyArraysz..*truth value of an empty array is ambiguous.*c                 Z    | j                  t        t        j                  g       f       y NrL   )r@   boolr*   r   r   s    r   test_1dz#TestTruthTestingEmptyArrays.test_1d#  s    t288B</:r    c                    | j                  t        t        j                  d      f       | j                  t        t        j                  d      f       | j                  t        t        j                  d      f       y )N)r%   r   rL   )r   r%   )r   r   )r@   r   r*   zerosr   s    r   test_2dz#TestTruthTestingEmptyArrays.test_2d&  s_    t288F+;*=>t288F+;*=>t288F+;*=>r    N)r/   rC   rD   r   r   r   r&   r    r   r   r     s    >G;?r    r   c                       e Zd Zd Zy)TestBincountc                 (    | j                  d        y )Nc                  4    t        j                  g dd       S )Nr%   rl      )	minlength)r*   bincountr&   r    r   r   z6TestBincount.test_bincount_minlength.<locals>.<lambda>/  s    r{{9'Mr    r@   r   s    r   test_bincount_minlengthz$TestBincount.test_bincount_minlength.  s    MNr    N)r/   rC   rD   r   r&   r    r   r   r   ,  s    Or    r   c                       e Zd Zd Zy)TestGeneratorSumc                 h    | j                  t        j                  d t        d      D        f       y )Nc              3       K   | ]  }|  y wr"   r&   ).0is     r   	<genexpr>z6TestGeneratorSum.test_generator_sum.<locals>.<genexpr>6  s     -BAas   r   rL   )r@   r*   sumranger   s    r   test_generator_sumz#TestGeneratorSum.test_generator_sum5  s&    rvv-Bq-B,DEr    N)r/   rC   rD   r   r&   r    r   r   r   3  s    Fr    r   c                       e Zd Zd Zy)TestFromstringc                 F    | j                  t        j                  d       y )N)zP                                                                                rL   )r@   r*   
fromstringr   s    r   test_fromstringzTestFromstring.test_fromstring;  s    r}}<@r    N)r/   rC   rD   r   r&   r    r   r   r   9  s    Ar    r   c                       e Zd ZdZej
                  j                  dddg      d        Zej
                  j                  dddg      d        Zy) TestFromStringAndFileInvalidDataz+string or file could not be read to its endinvalid_strz,invalid_datainvalid_sepc                 d   t        j                  g dt              }t        j                  d      5 |j                  dd       j                  |       j                  d       | j                  fd	       j                  d       | j                  fd
       t        j                         5  t        j                  dt               j                  d       t        j                  dd      }t        ||       d d d        d d d        y # 1 sw Y   xY w# 1 sw Y   y xY w)Ng)\(?rl   gGz@   r~   r>   mode,z%.2f)sepformatr   c                  2    t        j                   d      S Nr   )r   r*   fromfilefs   r   r   zVTestFromStringAndFileInvalidData.test_deprecate_unparsable_data_file.<locals>.<lambda>M  s    2;;qc+Br    c                  4    t        j                   dd      S Nr   r   r   countr   r   s   r   r   zVTestFromStringAndFileInvalidData.test_deprecate_unparsable_data_file.<locals>.<lambda>O  s    2;;qc+Kr    r)   r   r   )r*   r   floattempfileTemporaryFiletofilewriteseekr@   r   r   simplefilterrE   r   r   )r   r   xresr   s       @r   #test_deprecate_unparsable_data_filezDTestFromStringAndFileInvalidData.test_deprecate_unparsable_data_fileD  s    HH'u5##-HHQCH/GGK FF1I""#BCFF1I""#KL((*%%g/ABq	kk!A6"3*	 + .- +* .-s%   BD&9AD	D&D#	D&&D/c                 b   t        j                  g dt              }dj                  |      | j	                  fd       | j	                  fd       j                  d      | j	                  fd       t        t              5  t        j                  dd	
      }t        |d d |       d d d        t        j                         5  t        j                  dt               t        j                  dd
      }t        ||       d d d        y # 1 sw Y   exY w# 1 sw Y   y xY w)Nr   r   z1.51,2,3.51,4{}c                  2    t        j                   d      S r   r*   r   x_strs   r   r   zSTestFromStringAndFileInvalidData.test_deprecate_unparsable_string.<locals>.<lambda>\  s    r}}U'Dr    c                  4    t        j                   dd      S r   r  r  s   r   r   zSTestFromStringAndFileInvalidData.test_deprecate_unparsable_string.<locals>.<lambda>]  s    r}}U1'Mr    asciic                      t               S r"   r
   )bytestrs   r   r   zSTestFromStringAndFileInvalidData.test_deprecate_unparsable_string.<locals>.<lambda>b  s    'A''Jr    r   r   r   r)   r   )r*   r   r   r   r@   encoder   rE   r   r   r   r   r   )r   r   r   r  r  r  s       @@r    test_deprecate_unparsable_stringzATestFromStringAndFileInvalidData.test_deprecate_unparsable_stringW  s    HH'u5!((5DEMN ,,w'JK,- --3a8Cs3Bx+ . $$&!!'+=> --3a8CsA& '& .- '&s   (D?D%D"%D.N)	r/   rC   rD   r   rY   rZ   parametrizer  r  r&   r    r   r   r   ?  s]     <G[[]_m,LM+ N+$ [[]_m,LM' N'r    r   c                       e Zd Zd Zy)Test_GetSet_NumericOpsc                     ddl m} | j                  |d       | j                  t        j                  i        t        t        t        j                  d       y )Nr   )getset_numericopsrl   )r4   )r9   abc)add)r   r  r@   r*   set_numeric_opsr   
ValueError)r   r  s     r   test_get_numeric_opsz+Test_GetSet_NumericOps.test_get_numeric_opsu  sF    B0a8 	r11"=j""4"4%@r    N)r/   rC   rD   r  r&   r    r   r  r  s  s    Ar    r  c                       e Zd ZeZd Zy)TestShape1Fieldsc                 X    | j                  t        j                  dt        dfgf       y )Nre   r%   rL   )r@   r*   r~   r   r   s    r   test_shape_1_fieldsz$TestShape1Fields.test_shape_1_fields  s$    rxxc1.@Ar    N)r/   rC   rD   FutureWarningr   r  r&   r    r   r  r    s    KBr    r  c                       e Zd Zd Zy)TestNonZeroc                 L    | j                  d        | j                  d        y )Nc                  R    t        j                  t        j                  d            S )Nr   r*   nonzeror   r&   r    r   r   z(TestNonZero.test_zerod.<locals>.<lambda>      rzz"((1+'>r    c                  R    t        j                  t        j                  d            S r   r"  r&   r    r   r   z(TestNonZero.test_zerod.<locals>.<lambda>  r$  r    r   r   s    r   
test_zerodzTestNonZero.test_zerod  s     >?>?r    N)r/   rC   rD   r&  r&   r    r   r  r    s    @r    r  c                   <    e Zd Z ej                  d      Zd Zd Zy)TestToStringz0tostring() is deprecated. Use tobytes() instead.c                     t        j                  t        d      t         j                        }| j	                  |j
                         y Ns   testr   )r*   r   listuint8r@   tostringr   arrs     r   test_tostringzTestToString.test_tostring  s-    hhtK(9s||,r    c                     t        j                  t        d      t         j                        }|j	                         }t        t              5  |j                         }d d d        |k(  sJ y # 1 sw Y   xY wr*  )r*   r   r+  r,  tobytesr   rE   r-  )r   r/  rf   r   s       r   test_tostring_matches_tobytesz*TestToString.test_tostring_matches_tobytes  sS    hhtK(9KKM,-A .Avv .-s   A//A8N)r/   rC   rD   reescaper   r0  r3  r&   r    r   r(  r(    s    biiJKG-r    r(  c            
          e Zd ZdZej
                  ej                  ej                  ej                  ej                  ej                  ej                  ej                  ej                  ej                  g
Zd Zd Zd Zy)TestDTypeCoercionz(Converting .* to a dtype .*is deprecatedc                 j    | j                   D ]$  }| j                  t        j                  |f       & y r   )deprecated_typesr@   r*   r~   r   scalar_types     r   test_dtype_coercionz%TestDTypeCoercion.test_dtype_coercion  s+    00K""288;."A 1r    c                 l    | j                   D ]%  }| j                  t        j                  g |f       ' y r   )r9  r@   r*   r   r:  s     r   test_array_constructionz)TestDTypeCoercion.test_array_construction  s.    00K""2882{2D"E 1r    c                    t         j                  j                         D ]+  }|D ]$  }| j                  t         j                  |f       & - t
        t        t        t        fD ]$  }| j                  t         j                  |f       & y r   )	r*   sctypesvaluesrB   r~   typedictr+  r-   )r   groupr;  s      r   test_not_deprecatedz%TestDTypeCoercion.test_not_deprecated  sj    ZZ&&(E$**288;.*I  % ) !$e4K&&rxx{n&E 5r    N)r/   rC   rD   r   r*   genericflexiblenumberinexactfloatingcomplexfloatingintegerunsignedintegersignedinteger	characterr9  r<  r>  rE  r&   r    r   r7  r7    si    8G 	

BKK


BKK!3!3


B&&(8(8
BFFr    r7  c                   T   e Zd Zej                  ej
                  ej                  gZej                  ej                  ej                  ej                  ej                  ej                  ej                  ej                  ej                   ej"                  ej$                  gZd Zd Zy)BuiltInRoundComplexDTypec                     | j                   D ]V  } |d      }| j                  t        |f       | j                  t        |df       | j                  t        |fddi       X y Nr   rL   ndigitsrn   )r9  r@   roundr   r;  scalars      r   test_deprecatedz(BuiltInRoundComplexDType.test_deprecated  sb    00K ^F""5y"9""5{";""5y)Q"P	 1r    c                     | j                   D ]V  } |d      }| j                  t        |f       | j                  t        |df       | j                  t        |fddi       X y rS  )not_deprecated_typesrB   rU  rV  s      r   rE  z,BuiltInRoundComplexDType.test_not_deprecated  sc    44K ^F&&uF9&=&&uFA;&?&&uF9iQR^&T	 5r    N)r/   rC   rD   r*   csinglecdoubleclongdoubler9  int8int16int32int64r,  uint16uint32uint64float16float32float64rZ  rX  rE  r&   r    r   rQ  rQ    st    

BJJ?
288RXX
"))RYY		


BJJ

QUr    rQ  c                   p    e Zd ZdZej
                  j                  dddgfddgddgfg      d        Zd Zy))TestIncorrectAdvancedIndexWithEmptyResultz7Out of bound index found. This was previously ignored.*indexr   r   c                 l   t        j                  d      }| j                  |j                  |f       | j                  |j                  |df       t        j                  d      }t        dd      f|z   }| j                  |j                  |f       | j                  |j                  |df       y )N)rl   rl   r   rL           )rl   rl   r%   r   )r*   onesr@   __getitem____setitem__slice)r   rj  r/  arr2index2s        r   test_empty_subspacez=TestIncorrectAdvancedIndexWithEmptyResult.test_empty_subspace  s     ggi seX>seR[A wwy!1+%'t//vi@t//vrlCr    c                     t        j                  d      }dgdggg f}| j                  |j                  |f       | j                  |j                  |t        j
                  d      f       y )N)rl   rl   rl   r   rl   rL   )rl   r   rl   )r*   rm  rB   rn  ro  empty)r   r/  rj  s      r   )test_empty_index_broadcast_not_deprecatedzSTestIncorrectAdvancedIndexWithEmptyResult.test_empty_index_broadcast_not_deprecated  sf    ggi #sR ""3??%"B""3??).0C(D 	# 	Fr    N)	r/   rC   rD   r   rY   rZ   r  rs  rv  r&   r    r   ri  ri    sK    GG[[WAyAq6Aq62B&CDD EDFr    ri  c                       e Zd Zd Zy)TestNonExactMatchDeprecationc                     t        j                  g dg dg      | j                  fd       | j                  fd       y )N)r      rz  )r   r   r%   c                  4    t        j                   dd      S )N)   rz  Cilpr   )r*   ravel_multi_indexr/  s   r   r   zCTestNonExactMatchDeprecation.test_non_exact_match.<locals>.<lambda>  s    r';';Cf'Ur    c                  :    t        j                   d   dd      S )Nr   r   Random)side)r*   searchsortedr  s   r   r   zCTestNonExactMatchDeprecation.test_non_exact_match.<locals>.<lambda>  s    rs1vqx'Pr    )r*   r   r@   r.  s    @r   test_non_exact_matchz1TestNonExactMatchDeprecation.test_non_exact_match  s4    hh	9-.UVPQr    N)r/   rC   rD   r  r&   r    r   rx  rx    s    Rr    rx  c                       e Zd ZdZd Zy)TestMatrixInOuterzCadd.outer\(\) was passed a numpy matrix as (first|second) argument.c                    t        j                  g d      }t        j                  g d      j                  t         j                        }| j	                  t         j
                  j                  ||fd       | j	                  t         j
                  j                  ||f       | j	                  t         j
                  j                  ||f       | j                  t         j
                  j                  ||f       y )Nr   rl   )r8   r4   rL   )r*   r   viewmatrixr@   r  outerrB   )r   r/  ms      r   rX  z!TestMatrixInOuter.test_deprecated  s    hhy!HHY$$RYY/rvv||1a&a@rvv||3(;rvv||1c(;""266<<sCj"Ar    Nr/   rC   rD   r   rX  r&   r    r   r  r    s    +GBr    r  c                       e Zd ZdZd Zd Zy)FlatteningConcatenateUnsafeCastz7concatenate with `axis=None` will use same-kind castingc                     | j                  t        j                  dgdgfft        d t        j                  dt        j
                                     y )Nrl        ?rl   r   )axisoutrn   )r@   r*   concatenaterC  ru  ra  r   s    r   rX  z/FlatteningConcatenateUnsafeCast.test_deprecated  sB    r~~tbTl_288ARXX+FG 	 	Ir    c           	      f   | j                  t        j                  dgdgffd t        j                  dt        j                        dd       t        t              5  t        j                  dgdgft        j                  dt        j                        d	       d d d        y # 1 sw Y   y xY w)
Nrl  r  rl   r   unsafe)r  r  castingrn   	same_kind)r  r  )rB   r*   r  ru  ra  r   	TypeErrorr   s    r   rE  z3FlatteningConcatenateUnsafeCast.test_not_deprecated  s    ""2>>tbTl_ $RXXarxx-H#+- 	# 	.
 9%NNRD2$<RXXarxx-H#.0 &%%s   A B''B0N)r/   rC   rD   r   rX  rE  r&   r    r   r  r    s    GGI
	0r    r  c                       e Zd ZdZdZd Zy)"TestDeprecatedUnpickleObjectScalarz
    Technically, it should be impossible to create numpy object scalars,
    but there was an unpickle path that would in theory allow it. That
    path is invalid and must lead to the warning.
    z4Unpickling a scalar with object dtype is deprecated.c                 v    t         j                  j                  j                  | j	                  fd       y )Nc                  <      t        j                  d      d      S )NOr%   r   )ctors   r   r   zDTestDeprecatedUnpickleObjectScalar.test_deprecated.<locals>.<lambda>(  s    tBHHSM1'=r    )r*   core
multiarrayrW  r@   )r   r  s    @r   rX  z2TestDeprecatedUnpickleObjectScalar.test_deprecated&  s'    ww!!((=>r    N)r/   rC   rD   rX   r   rX  r&   r    r   r  r    s    
 EG?r    r  c                       e Zd ZdZd Zy)TestSingleElementSignaturezThe use of a length 1c                 L    | j                  d        | j                  d        y )Nc                  2    t        j                  ddd      S )Nr%   rl   d)	signature)r*   r  r&   r    r   r   z<TestSingleElementSignature.test_deprecated.<locals>.<lambda>0  s    rvvac'Br    c                  Z    t        j                  ddt        j                  d      f      S )Nr%   rl   l)sig)r*   r  r~   r&   r    r   r   z<TestSingleElementSignature.test_deprecated.<locals>.<lambda>1  s    rvva#8H'Ir    r   r   s    r   rX  z*TestSingleElementSignature.test_deprecated/  s     BCIJr    Nr  r&   r    r   r  r  +  s    &GKr    r  c                       e Zd ZeZ ej                  dg      j                  Zej                  j                  dg d      deddfd       Zej                  j                  dg d      deddfd       Zy)	TestCtypesGetterr%   name)get_data	get_shapeget_stridesget_as_parameterreturnNc                 Z    t        | j                  |      | j                  fd       y )Nc                               S r"   r&   funcs   r   r   z2TestCtypesGetter.test_deprecated.<locals>.<lambda>>  s    tvr    )getattrctypesr@   )r   r  r  s     @r   rX  z TestCtypesGetter.test_deprecated9  s#     t{{D)~.r    )ra   shapestrides_as_parameter_c                 2      j                   fd       y )Nc                  0    t        j                         S r"   )r  r  )r  r   s   r   r   z6TestCtypesGetter.test_not_deprecated.<locals>.<lambda>D  s    74;;+Er    rB   )r   r  s   ``r   rE  z$TestCtypesGetter.test_not_deprecated@  s     	""#EFr    )r/   rC   rD   rE   r   r*   r   r  rY   rZ   r  r1   rX  rE  r&   r    r   r  r  4  s    $KRXXqc]!!F[[L/C /D // [[>G G GGr    r  r`   c                 T    t        j                  t        j                  d      |       S Nr`   )r*   	partitionrb   kths    r   r   r   J  s    bll299R=#&Fr    c                 T    t        j                  t        j                  d      |       S r  )r*   argpartitionrb   r  s    r   r   r   K  s    2)Lr    )zpartition methodzargpartition methodzpartition functionzargpartition functionr  )idsc                        e Zd ZeZdZd Zd Zy)TestPartitionBoolIndexz1Passing booleans as partition index is deprecatedc                 V    | j                  fd       | j                  fd       y )Nc                        d      S )NTr&   r  s   r   r   z8TestPartitionBoolIndex.test_deprecated.<locals>.<lambda>V  s	    tDzr    c                        ddg      S )NFTr&   r  s   r   r   z8TestPartitionBoolIndex.test_deprecated.<locals>.<lambda>W  s    tUDM':r    r   r   r  s    `r   rX  z&TestPartitionBoolIndex.test_deprecatedU  s!    12:;r    c                 V    | j                  fd       | j                  fd       y )Nc                        d      S r   r&   r  s   r   r   z<TestPartitionBoolIndex.test_not_deprecated.<locals>.<lambda>Z  s	    47r    c                        ddg      S )Nr   r%   r&   r  s   r   r   z<TestPartitionBoolIndex.test_not_deprecated.<locals>.<lambda>[  s    4A<r    r  r  s    `r   rE  z*TestPartitionBoolIndex.test_not_deprecatedY  s     ""?3""#78r    N)r/   rC   rD   rE   r   r   rX  rE  r&   r    r   r  r  O  s     %KAG<9r    r  c                       e Zd ZeZd Zy)
TestMachArc                 (    | j                  d        y )Nc                  6    t        t        j                  d      S )NMachAr)r  r*   r  r&   r    r   r   z3TestMachAr.test_deprecated_module.<locals>.<lambda>c  s    wrww'Ar    r   r   s    r   test_deprecated_modulez!TestMachAr.test_deprecated_moduleb  s    ABr    N)r/   rC   rD   rE   r   r  r&   r    r   r  r  ^  s    $KCr    r  c                   D   e Zd Zej                  j                  dej                  ej                  ej                  ej                  g      d        Zej                  j                  dej                  ej                  ej                  ej                  g      d        Zy)$TestQuantileInterpolationDeprecationr  c                 V    | j                  fd       | j                  fd       y )Nc                        ddgdd      S )Nrl  r  linearinterpolationr&   r  s   r   r   zFTestQuantileInterpolationDeprecation.test_deprecated.<locals>.<lambda>l  s    D"b2X>r    c                        ddgdd      S )Nrl  r  nearestr  r&   r  s   r   r   zFTestQuantileInterpolationDeprecation.test_deprecated.<locals>.<lambda>n  s    D"b2Y?r    r   r  s    `r   rX  z4TestQuantileInterpolationDeprecation.test_deprecatedh  s)     	>	@?	Ar    c                    t        j                         5  t        j                  dt               t	        j
                  t              5   |ddgddd       d d d        d d d        y # 1 sw Y   xY w# 1 sw Y   y xY w)Nr   rl  r  r  )r  method)r   r   r   rE   rY   raisesr  r  s     r   test_both_passedz5TestQuantileInterpolationDeprecation.test_both_passedp  s^     $$&!!(,>?y)b"Xr9M * '& *) '&s#   4A5	A)A5)A2	.A55A>N)r/   rC   rD   rY   rZ   r  r*   
percentilequantilenanpercentilenanquantilerX  r  r&   r    r   r  r  f  s    [[V	R%5%5r~~FHAHA [[V]]BKK)9)92>>JLNLNr    r  c                       e Zd Zd Zy)TestMemEventHookc                 V   dd l mc m} t        j                  t
        d      5  |j                          d d d        t        j                  d      }~t                t        j                  t
        d      5  |j                          d d d        y # 1 sw Y   ^xY w# 1 sw Y   y xY w)Nr   z$PyDataMem_SetEventHook is deprecatedmatchi  )r   r  _multiarray_testsrY   warnsrE   !test_pydatamem_seteventhook_startr*   r   r	   test_pydatamem_seteventhook_end)r   ma_testsre   s      r   test_mem_seteventhookz&TestMemEventHook.test_mem_seteventhook|  s     	87\\, FH668H
 HHTN\\, FH446H HH HH Hs   B9BBB(N)r/   rC   rD   r  r&   r    r   r  r  z  s    7r    r  c                       e Zd ZdZd Zy)TestArrayFinalizeNonez!Setting __array_finalize__ = Nonec                 `     G d dt         j                        | j                  fd       y )Nc                       e Zd ZdZy)ETestArrayFinalizeNone.test_use_none_is_deprecated.<locals>.NoFinalizeN)r/   rC   rD   __array_finalize__r&   r    r   
NoFinalizer    s    !%r    r  c                  L    t        j                  d      j                         S r   )r*   r   r  )r  s   r   r   zCTestArrayFinalizeNone.test_use_none_is_deprecated.<locals>.<lambda>  s    rxx{'7'7
'Cr    )r*   ndarrayr@   )r   r  s    @r   test_use_none_is_deprecatedz1TestArrayFinalizeNone.test_use_none_is_deprecated  s$    	& 	& 	CDr    N)r/   rC   rD   r   r  r&   r    r   r  r    s    1GEr    r  c                       e Zd ZdZd Zy)TestAxisNotMAXDIMSz)Using `axis=32` \(MAXDIMS\) is deprecatedc                 X    t        j                  d      | j                  fd       y )N) r%   r%   r%   r%   r%   r%   r%   r%   r%   r%   r%   r%   r%   r%   r%   r%   r%   r%   r%   r%   r%   r%   r%   r%   r%   r%   r%   r%   r%   r%   r%   r%   c                  P    t        j                   dt         j                        S )Nr%   )r  )r*   repeatMAXDIMS)re   s   r   r   z4TestAxisNotMAXDIMS.test_deprecated.<locals>.<lambda>  s    ryyABJJ'Gr    )r*   r   r@   r   s    @r   rX  z"TestAxisNotMAXDIMS.test_deprecated  s     HHWGHr    Nr  r&   r    r   r  r    s    :GIr    r  c                       e Zd ZdZej
                  j                  dej                  d         d        Z	ej
                  j                  dej                  d         d        Z
y)TestLoadtxtParseIntsViaFloatz;loadtxt\(\): Parsing an integer via a float is deprecated.*r~   
AllIntegerc                     t        j                  t        | j                        5  t	        j
                  dg|       d d d        y # 1 sw Y   y xY w)Nr  10.5r   )rY   r  rE   r   r*   loadtxt)r   r~   s     r   test_deprecated_warningz4TestLoadtxtParseIntsViaFloat.test_deprecated_warning  s2    \\,DLLAJJxu- BAAs   AAc                     t        j                         5  t        j                  dt               	 t	        j
                  dg|       d d d        y # t        $ r&}t        |j                  t              sJ Y d }~3d }~ww xY w# 1 sw Y   y xY w)Nr)   r  r   )	r   r   r   rE   r*   r  r  
isinstance	__cause__)r   r~   es      r   test_deprecated_raisedz3TestLoadtxtParseIntsViaFloat.test_deprecated_raised  sq     $$&!!'+=>C

F851 '&  C!!++/ABBBC	 '&s.   BA	BA<7B<BBBN)r/   rC   rD   r   rY   rZ   r  r*   	typecodesr  r  r&   r    r   r  r    sh     MG[[Wbll<&@A. B. [[Wbll<&@AC BCr    r  c                       e Zd Zd Zd Zy)TestScalarConversionc                 \    | j                  t        t        j                  dg      f       y )NQ	@rL   )r@   r   r*   r   r   s    r   test_float_conversionz*TestScalarConversion.test_float_conversion  s#    uBHHdV,<+>?r    c                     t        j                  dgg      }t        j                  d      }t        j                  t
              5  ||d<   d d d        y # 1 sw Y   y xY w)Nr  r   r   )r*   r   r   rY   r  rE   )r   rf   cs      r   test_behaviourz#TestScalarConversion.test_behaviour  sC    HHtfXHHQK\\,-AaD .--s   AAN)r/   rC   rD   r  r  r&   r    r   r  r    s    @r    r  c                   n    e Zd ZdZej
                  j                  dej                  d         d        Z	y)TestPyIntConversionz,.*stop allowing conversion of out-of-bound.*r~   r  c                    t        j                        t        j                        d }d }d }|||fD ]0  	 | j                  fd       	 | j                  fd       2 y # t        $ r Y %w xY w# t        $ r Y Nw xY w)Nc                 &    |j                  |        y r"   )rB  valuer~   s     r   rW  z:TestPyIntConversion.test_deprecated_scalar.<locals>.scalar  s    JJur    c                 @    t        j                  g d|      }| |d<   y )N)r   r   r   r   rl   r*   r   )r  r~   r/  s      r   assignz:TestPyIntConversion.test_deprecated_scalar.<locals>.assign  s    ((9E2CCFr    c                 4    t        j                  | g|       y )Nr   r  r  s     r   createz:TestPyIntConversion.test_deprecated_scalar.<locals>.create  s    HHeWE*r    c                  0      j                   dz
        S r   )mincreation_funcr~   infos   r   r   z<TestPyIntConversion.test_deprecated_scalar.<locals>.<lambda>      dhhlE Br    c                  0      j                   dz         S r   )maxr#  s   r   r   z<TestPyIntConversion.test_deprecated_scalar.<locals>.<lambda>  r&  r    )r*   r~   iinfor@   OverflowError)r   r~   rW  r  r   r$  r%  s    `   @@r   test_deprecated_scalarz*TestPyIntConversion.test_deprecated_scalar  s    xx			+ %ff5M&&BD
&&BD 6 !  ! s$    A0A?0	A<;A<?	B
BN)
r/   rC   rD   r   rY   rZ   r  r*   r  r+  r&   r    r   r  r    s4    =G[[Wbll<&@A Br    r  c                       e Zd Zd Zy)TestDeprecatedGlobalsc                     | j                  d        | j                  d        | j                  d        | j                  d        | j                  d        | j                  d        y )Nc                  "    t         j                  S r"   )r*   bool8r&   r    r   r   z9TestDeprecatedGlobals.test_type_aliases.<locals>.<lambda>      rxxr    c                  "    t         j                  S r"   )r*   int0r&   r    r   r   z9TestDeprecatedGlobals.test_type_aliases.<locals>.<lambda>      rwwr    c                  "    t         j                  S r"   )r*   uint0r&   r    r   r   z9TestDeprecatedGlobals.test_type_aliases.<locals>.<lambda>  r1  r    c                  "    t         j                  S r"   )r*   bytes0r&   r    r   r   z9TestDeprecatedGlobals.test_type_aliases.<locals>.<lambda>  s    ryyr    c                  "    t         j                  S r"   )r*   str0r&   r    r   r   z9TestDeprecatedGlobals.test_type_aliases.<locals>.<lambda>  r4  r    c                  "    t         j                  S r"   )r*   object0r&   r    r   r   z9TestDeprecatedGlobals.test_type_aliases.<locals>.<lambda>  s    rzzr    r   r   s    r   test_type_aliasesz'TestDeprecatedGlobals.test_type_aliases  sZ    /0//001/12r    N)r/   rC   rD   r=  r&   r    r   r-  r-    s    3r    r-  r  )r   longulongr1   bytesobjectc                    | t        t              vsJ t        j                  t        d|        5  t        t        |       rJ 	 d d d        t        j                  |        | t        j                  v  y # 1 sw Y   1xY w)NzIn the future .*r  )dirr*   rY   r  r  hasattrr~   
sctypeDict)r  s    r   test_future_scalar_attributesrF    sj     s2w	m$TF+
-2t$$$$
-
 HHTNBMM
- 
-s   A66A?z"ignore:In the future:FutureWarningc                   T    e Zd Zej                  j                  dg d      d        Zy)TestRemovedGlobalsr  )rA  r   r   complexr1   r   c                     d| d}t        j                  t        |      5  t        t        |       d d d        y # 1 sw Y   y xY w)Nz.*
`np.z(` was a deprecated alias for the builtinr  )rY   r  AttributeErrorr  r*   )r   r  r=   s      r   !test_attributeerror_includes_infoz4TestRemovedGlobals.test_attributeerror_includes_info  s7     FG]]>5B 655s	   <AN)r/   rC   rD   rY   rZ   r  rL  r&   r    r   rH  rH    s,     [[V@BBr    rH  c                       e Zd Zd Zy)TestDeprecatedFinfoc                 F    | j                  t        j                  d       y )Nr"   rL   )r@   r*   finfor   s    r   test_deprecated_nonez(TestDeprecatedFinfo.test_deprecated_none  s    rxxg6r    N)r/   rC   rD   rQ  r&   r    r   rN  rN    s    7r    rN  c                   *    e Zd Zd Zd Zd Zd Zd Zy)TestFromnumericc                 (    | j                  d        y )Nc                  V    t        j                  t        j                  g d            S )N)g      ?g      @g      @)r*   round_r   r&   r    r   r   z-TestFromnumeric.test_round_.<locals>.<lambda>  s    ryy/1J'Kr    r   r   s    r   test_round_zTestFromnumeric.test_round_      KLr    c                 (    | j                  d        y )Nc                  V    t        j                  t        j                  g d            S Nr   )r*   
cumproductr   r&   r    r   r   z1TestFromnumeric.test_cumproduct.<locals>.<lambda>  s    r}}RXXi5H'Ir    r   r   s    r   test_cumproductzTestFromnumeric.test_cumproduct  s    IJr    c                 (    | j                  d        y )Nc                  V    t        j                  t        j                  g d            S r[  )r*   productr   r&   r    r   r   z.TestFromnumeric.test_product.<locals>.<lambda>   s    rzz"((92E'Fr    r   r   s    r   test_productzTestFromnumeric.test_product  s    FGr    c                 (    | j                  d        y )Nc                  V    t        j                  t        j                  ddg            S NTF)r*   sometruer   r&   r    r   r   z/TestFromnumeric.test_sometrue.<locals>.<lambda>$  s    r{{288T5M3J'Kr    r   r   s    r   test_sometruezTestFromnumeric.test_sometrue#  rX  r    c                 (    | j                  d        y )Nc                  V    t        j                  t        j                  ddg            S rd  )r*   alltruer   r&   r    r   r   z.TestFromnumeric.test_alltrue.<locals>.<lambda>(  s    rzz"((D%=2I'Jr    r   r   s    r   test_alltruezTestFromnumeric.test_alltrue'  s    JKr    N)r/   rC   rD   rW  r]  ra  rf  rj  r&   r    r   rS  rS    s     MKHMLr    rS  c                       e Zd Zd Zd Zy)TestMathAliasc                 (    | j                  d        y )Nc                  "    t         j                  S r"   )r*   mathr&   r    r   r   z7TestMathAlias.test_deprecated_np_math.<locals>.<lambda>.  r4  r    r   r   s    r   test_deprecated_np_mathz%TestMathAlias.test_deprecated_np_math-  s    /r    c                 (    | j                  d        y )Nc                  6    t         j                  j                  S r"   )r*   libro  r&   r    r   r   z;TestMathAlias.test_deprecated_np_lib_math.<locals>.<lambda>1  s    rvv{{r    r   r   s    r   test_deprecated_np_lib_mathz)TestMathAlias.test_deprecated_np_lib_math0  s    23r    N)r/   rC   rD   rp  rt  r&   r    r   rl  rl  +  s    04r    rl  )LrX   rT   operatorr   rY   r   r4  sysnumpyr*   numpy.testingr   r   r   r   r   r   r	   r   r   rR   r\   ImportErrorr   rG   rJ   r^   ri   rx   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r(  r7  rQ  ri  rx  r  r  r  r  r  rb   r  r  PARTITION_DICTrZ   r  rA  r  r  r  r  r  r  r  r  r  r-  rF  r   rH  rN  rS  rl  r&   r    r   <module>r{     ss  
      	 
   
 DI
iF iFX/"6 /:1 :*E2F E$I@T I49+? 9"- -
02 
00' 0H+ HH+ HD, D 
?"6 
?O' OF+ FA) A1''; 1'h	A1 	AB+ B@& @'  F, F>U3 U0F0D F6R#7 RB, B0&: 0*?)= ?K!5 KG+ G( "		"//$299R=55FL	 !6!6!8nM91 9 N9C% CN+? N(7+ 7&E0 EI- IC#7 C2	/ 	. D	30 	3 ;=	=	 @A
 
 B
7. 7
L* L,4( 4e  Is   K KK