/ lib / numpy / testing / _private / utils.pyc
utils.pyc
   1  o

   2  \��cma�@sdZddlZddlZddlZddlZddlZddlZddlZddlm	Z	m
   3  Z
   4  ddlZddlZddl
mZmZddlmZddlmZddlZddlZddlmZmZmZmZmZmZmZmZddlZddl m!Z!gd	�Z"Gd
   5  d�de#�Z$e$Z%dZ&e�'�dvZ(ej)j*d
kZ+e,ed�Z-e.edd�duo�e-Z/ej0j1j2Z3dd�Z4dd�Z5d�dd�Z6dd�Z7dd�Z8dd�Z9ej*dkr�		d�dd �Z:d�d"d#�Z;nejdd$�d%kr�d&e�<��d'�fd(d#�Z;nd)d#�Z;ejdd$�d%kr�d&e�<��d'�gfd*d+�Z=ngfd,d+�Z=	-	0d�d1d2�Z>d�d3d4�Z?d5d6�Z@e�A�d�d8d9��ZBe�A�d�d:d;��ZCe�A�		.d�d=d>�d?d@��ZDd�d=d>�dAdB�ZEe�A�d�dCdD��ZFd�dEdF�ZGdGdH�ZHdIdJ�ZId�dKdL�ZJdMdN�ZKddlLZLGdOdP�dPeLjM�ZNeNdQ�ZOdRdS�ZPdTdU�ZQd�dVdW�ZRd�dYdZ�ZSd[d\�ZT	.	.d�d^d_�ZUd�d`da�ZVd�dbdc�ZWd�ddde�ZXdfdg�ZYdhdi�ZZej[d�djdk��Z\dldm�Z]ej[d�dndo��Z^dpdq�Z_edrdsfdtdu�Z`Gdvdw�dwe#�Zaej[dxdy��Zbej[dzd{��ZcGd|d}�d}ejd�ZeGd~d�d�Zfej[d�d�d���Zgd�d��Zhd�d��Zid�d��Zjd�d��Zkd�d��Zld�d��Zmd�d��Znd�d��Zoeo�Zpd�d�ZqdS)�z*
   6  Utility function to facilitate testing.
   7  
   8  �N)�partial�wraps)�mkdtemp�mkstemp)�SkipTest)�WarningMessage)�intp�float32�empty�arange�
   9  array_repr�ndarray�isnat�array)�StringIO))�assert_equal�assert_almost_equal�assert_approx_equal�assert_array_equal�assert_array_less�assert_string_equal�assert_array_almost_equal�
assert_raises�
build_err_msg�decorate_methods�jiffies�memusage�print_assert_equal�raises�rundocs�	runstring�verbose�measure�assert_�assert_array_almost_equal_nulp�assert_raises_regex�assert_array_max_ulp�assert_warns�assert_no_warnings�assert_allclose�IgnoreException�clear_and_catch_warningsr�KnownFailureException�temppath�tempdir�IS_PYPY�HAS_REFCOUNT�IS_WASM�suppress_warnings�assert_array_compare�assert_no_gc_cycles�break_cycles�HAS_LAPACK64�	IS_PYSTON�_OLD_PROMOTIONc@�eZdZdZdS)r,z<Raise this exception to mark a test as a known failing test.N��__name__�
  10  __module__�__qualname__�__doc__�r?r?��C:\Users\Jacks.GUTTSPC\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\numpy\testing\_private\utils.pyr,+�r,)Zwasm32Zwasm64�pypyZpyston_version_info�getrefcountcCst��dkS)N�legacy)�np�_get_promotion_stater?r?r?r@�<lambda>9srGcCsRd}d}zddl}Wntyd}Ynw|j|krd}|s'd|}t|��|S)z# Import nose only when needed.
  11      T)�rrrNFzANeed nose >= %d.%d.%d for tests - see https://nose.readthedocs.io)�nose�ImportError�__versioninfo__)Znose_is_goodZminimum_nose_versionrI�msgr?r?r@�import_nose<s�
  12  �rM�cCs:d}|sz|�}Wt|��ty|}Yt|��wdS)aI
  13      Assert that works in release mode.
  14      Accepts callable msg to allow deferring evaluation until failure.
  15  
  16      The Python built-in ``assert`` does not work when executing code in
  17      optimized mode (the ``-O`` flag) - no byte-code is generated for it.
  18  
  19      For documentation on usage, refer to the Python documentation.
  20  
  21      TN)�	TypeError�AssertionError)�valrL�__tracebackhide__�smsgr?r?r@r#Rs���r#cCs.ddlm}||�}t|tt��rtd��|S)a�like isnan, but always raise an error if type not supported instead of
  22      returning a TypeError object.
  23  
  24      Notes
  25      -----
  26      isnan and other ufunc sometimes return a NotImplementedType object instead
  27      of raising any exception. This function is a wrapper to make sure an
  28      exception is always raised.
  29  
  30      This should be removed once this problem is solved at the Ufunc level.r)�isnanz!isnan not supported for this type)�
  31  numpy.corerT�
  32  isinstance�type�NotImplementedrO)�xrT�str?r?r@�gisnanfs
  33  r[cC�^ddlm}m}|dd��||�}t|tt��rtd��Wd�|S1s(wY|S)a�like isfinite, but always raise an error if type not supported instead
  34      of returning a TypeError object.
  35  
  36      Notes
  37      -----
  38      isfinite and other ufunc sometimes return a NotImplementedType object
  39      instead of raising any exception. This function is a wrapper to make sure
  40      an exception is always raised.
  41  
  42      This should be removed once this problem is solved at the Ufunc level.r)�isfinite�errstate�ignore��invalidz$isfinite not supported for this typeN)rUr]r^rVrWrXrO)rYr]r^rZr?r?r@�	gisfinitex��
  43  ��rbcCr\)a�like isinf, but always raise an error if type not supported instead of
  44      returning a TypeError object.
  45  
  46      Notes
  47      -----
  48      isinf and other ufunc sometimes return a NotImplementedType object instead
  49      of raising any exception. This function is a wrapper to make sure an
  50      exception is always raised.
  51  
  52      This should be removed once this problem is solved at the Ufunc level.r)�isinfr^r_r`z!isinf not supported for this typeN)rUrdr^rVrWrXrO)rYrdr^rZr?r?r@�gisinf�rcre�nt�����c	Cs�ddl}|dur|j}|�|||d||f�}|��}z(|�||�}	z|�|�|�|	|�\}
  53  }|W|�|	�W|�|�S|�|	�w|�|�w)Nr)	�win32pdh�PDH_FMT_LONGZMakeCounterPathZ	OpenQueryZ
  54  AddCounterZCollectQueryDataZGetFormattedCounterValueZ
RemoveCounterZ
  55  CloseQuery)�object�counter�instanceZinum�format�machinerh�pathZhq�hcrWrQr?r?r@�GetPerformanceAttributes�s"
  56  �
  57  �rq�pythoncCsddl}tdd|||jd�S)Nr�Processz
Virtual Bytes)rhrqri)�processNamerlrhr?r?r@r�s
  58  �r��linuxz/proc/z/statcCs\z#t|d��}|���d�}Wd�n1swYt|d�WSty-YdSw)zM
  59          Return virtual memory size in bytes of the running python.
  60  
  61          �r� N�)�open�readline�split�int�	Exception)�_proc_pid_stat�f�lr?r?r@r�s��cCst�)zK
  62          Return memory usage of running python. [Not implemented]
  63  
  64          )�NotImplementedErrorr?r?r?r@r�scCs�ddl}|s
|�|���z#t|d��}|���d�}Wd�n1s%wYt|d�WStyEtd|��|d�YSw)��
  65          Return number of jiffies elapsed.
  66  
  67          Return number of jiffies (1/100ths of a second) that this
  68          process has been scheduled in user mode. See man 5 proc.
  69  
  70          rNrwrx�
�d)�time�appendrzr{r|r}r~)r�
  71  _load_timer�r�r�r?r?r@r�s��rcCs2ddl}|s
|�|���td|��|d�S)r�rNr�)r�r�r})r�r�r?r?r@r�s�Items are not equal:T�ZACTUALZDESIRED�cCsd|g}|r'|�d�dkr"t|�dt|�kr"|dd|g}n|�|�|r�t|�D]Z\}}t|t�r=tt|d�}	nt}	z|	|�}
  72  Wnt	yc}zdt
  73  |�j�d|�d	�}
  74  WYd}~nd}~ww|
  75  �d�d
  76  krzd�
|
  77  ��dd
  78  ��}
  79  |
  80  d7}
  81  |�d||�d|
  82  ���q-d�
|�S)
N�
  83  rg�Orrx)�	precisionz[repr failed for <z>: �]�z...�: )�find�lenr��	enumeraterVr
rr�reprr~rWr;�count�join�
  84  splitlines)�arrays�err_msg�headerr!�namesr�rL�i�aZr_funcrw�excr?r?r@r�s*
  85  "
  86  
  87  $��
  88  rc
  89  Csxd}t|t�rEt|t�sttt|����tt|�t|�||�|��D]\}}||vr1tt|���t||||d|�d|��|�q#dSt|tt	f�rzt|tt	f�rztt|�t|�||�t
  90  t|��D]}t||||d|�d|��|�qddSddlm}m
}m}	ddlm}
  91  m}m}t||�s�t||�r�t||||�St||g||d	�}
z
  92  |
  93  |�p�|
  94  |�}Wn
ttfy�d
  95  }Ynw|r�|
  96  |�r�||�}||�}n|}d}|
  97  |�r�||�}||�}n|}d}zt||�t||�Wnty�t|
��w||�||�k�r	t|
��z(t|�}t|�}t�|�jjt�|�jjk}|�r0|�r0|�r,WdSt|
��Wn
tttf�y>YnwzFt|�}t|�}|�rQ|�rQWdSt�|�}t�|�}|jjdv�si|jjdv�rmtd��|dk�r�|dk�r�|	|�|	|�k�s�t|
��Wn
tttf�y�Ynwz||k�s�t|
��WdSttf�y�}z
d
|j dv�r�t|
���d}~ww)a
  98      Raises an AssertionError if two objects are not equal.
  99  
 100      Given two objects (scalars, lists, tuples, dictionaries or numpy arrays),
 101      check that all elements of these objects are equal. An exception is raised
 102      at the first conflicting values.
 103  
 104      When one of `actual` and `desired` is a scalar and the other is array_like,
 105      the function checks that each element of the array_like object is equal to
 106      the scalar.
 107  
 108      This function handles NaN comparisons as if NaN was a "normal" number.
 109      That is, AssertionError is not raised if both objects have NaNs in the same
 110      positions.  This is in contrast to the IEEE standard on NaNs, which says
 111      that NaN compared to anything must return False.
 112  
 113      Parameters
 114      ----------
 115      actual : array_like
 116          The object to check.
 117      desired : array_like
 118          The expected object.
 119      err_msg : str, optional
 120          The error message to be printed in case of failure.
 121      verbose : bool, optional
 122          If True, the conflicting values are appended to the error message.
 123  
 124      Raises
 125      ------
 126      AssertionError
 127          If actual and desired are not equal.
 128  
 129      Examples
 130      --------
 131      >>> np.testing.assert_equal([4,5], [4,6])
 132      Traceback (most recent call last):
 133          ...
 134      AssertionError:
 135      Items are not equal:
 136      item=1
 137       ACTUAL: 5
 138       DESIRED: 6
 139  
 140      The following comparison does not raise an exception.  There are NaNs
 141      in the inputs, but they are in the same positions.
 142  
 143      >>> np.testing.assert_equal(np.array([1.0, 2.0, np.nan]), [1, 2, np.nan])
 144  
 145      Tzkey=r�Nzitem=r)r
�isscalar�signbit��iscomplexobj�real�imag�r!F�Mmz0cannot compare to a scalar with a different typezelementwise == comparison)!rV�dictrPr�rWrr��items�list�tuple�rangerUr
r�r��	numpy.libr�r�r�rr�
 146  ValueErrorrOrrE�asarray�dtyper�r[�char�DeprecationWarning�
FutureWarning�args)�actual�desiredr�r!rR�kr�r
r�r�r�r�r�rL�
 147  usecomplex�actualr�actuali�desiredr�desirediZisdesnatZisactnatZdtypes_matchZisdesnanZisactnanZarray_actualZ
array_desired�er?r?r@rs�2
 148  
 149  ���
 150  
 151  
 152  ����
 153  
 154  ��
 155  ���rcCs`d}ddl}||ks.t�}|�|�|�d�|�||�|�d�|�||�t|����dS)a�
 156      Test if two objects are equal, and print an error message if test fails.
 157  
 158      The test is performed with ``actual == desired``.
 159  
 160      Parameters
 161      ----------
 162      test_string : str
 163          The message supplied to AssertionError.
 164      actual : object
 165          The object to test for equality against `desired`.
 166      desired : object
 167          The expected result.
 168  
 169      Examples
 170      --------
 171      >>> np.testing.print_assert_equal('Test XYZ of func xyz', [0, 1], [0, 1])
 172      >>> np.testing.print_assert_equal('Test XYZ of func xyz', [0, 1], [0, 2])
 173      Traceback (most recent call last):
 174      ...
 175      AssertionError: Test XYZ of func xyz failed
 176      ACTUAL:
 177      [0, 1]
 178      DESIRED:
 179      [0, 2]
 180  
 181      TrNz failed
 182  ACTUAL: 
 183  z
 184  DESIRED: 
 185  )�pprintr�writerP�getvalue)�test_stringr�r�rRr�rLr?r?r@r�s
 186  
 187  
 188  �r�c	s�d}ddlm}ddlm}m}m}	z
 189  |��p|��}
 190  Wnty'd}
 191  Ynw�����fdd�}|
 192  rs|��rA|��}|	��}
n�}d}
|��rR|��}|	��}n�}d}zt||�d�t|
|�d�Wntyrt|���wt	�|t
 193  tf�s�t	�|t
 194  tf�r�t�����Sz.t
��r�t
��s�t��s�t��r�t��r�t��s�t|���Wd	S��ks�t|���Wd	SWnttfy�Ynwt���t�d
 195  d��kr�t|���d	S)a$	
 196      Raises an AssertionError if two items are not equal up to desired
 197      precision.
 198  
 199      .. note:: It is recommended to use one of `assert_allclose`,
 200                `assert_array_almost_equal_nulp` or `assert_array_max_ulp`
 201                instead of this function for more consistent floating point
 202                comparisons.
 203  
 204      The test verifies that the elements of `actual` and `desired` satisfy.
 205  
 206          ``abs(desired-actual) < float64(1.5 * 10**(-decimal))``
 207  
 208      That is a looser test than originally documented, but agrees with what the
 209      actual implementation in `assert_array_almost_equal` did up to rounding
 210      vagaries. An exception is raised at conflicting values. For ndarrays this
 211      delegates to assert_array_almost_equal
 212  
 213      Parameters
 214      ----------
 215      actual : array_like
 216          The object to check.
 217      desired : array_like
 218          The expected object.
 219      decimal : int, optional
 220          Desired precision, default is 7.
 221      err_msg : str, optional
 222          The error message to be printed in case of failure.
 223      verbose : bool, optional
 224          If True, the conflicting values are appended to the error message.
 225  
 226      Raises
 227      ------
 228      AssertionError
 229        If actual and desired are not equal up to specified precision.
 230  
 231      See Also
 232      --------
 233      assert_allclose: Compare two array_like objects for equality with desired
 234                       relative and/or absolute precision.
 235      assert_array_almost_equal_nulp, assert_array_max_ulp, assert_equal
 236  
 237      Examples
 238      --------
 239      >>> from numpy.testing import assert_almost_equal
 240      >>> assert_almost_equal(2.3333333333333, 2.33333334)
 241      >>> assert_almost_equal(2.3333333333333, 2.33333334, decimal=10)
 242      Traceback (most recent call last):
 243          ...
 244      AssertionError:
 245      Arrays are not almost equal to 10 decimals
 246       ACTUAL: 2.3333333333333
 247       DESIRED: 2.33333334
 248  
 249      >>> assert_almost_equal(np.array([1.0,2.3333333333333]),
 250      ...                     np.array([1.0,2.33333334]), decimal=9)
 251      Traceback (most recent call last):
 252          ...
 253      AssertionError:
 254      Arrays are not almost equal to 9 decimals
 255      <BLANKLINE>
 256      Mismatched elements: 1 / 2 (50%)
 257      Max absolute difference: 6.66669964e-09
 258      Max relative difference: 2.85715698e-09
 259       x: array([1.         , 2.333333333])
 260       y: array([1.        , 2.33333334])
 261  
 262      Tr)r
r�Fcsd�}t��g��|d�S)N�*Arrays are not almost equal to %d decimals)r!r�)r)r��r��decimalr�r�r!r?r@�_build_err_msg2s�z+assert_almost_equal.<locals>._build_err_msg)r�N��?�$@)rUr
r�r�r�r�r�rrPrVr�r�rrbr[r�rO�absrE�float64)r�r�r�r�r!rRr
r�r�r�r�r�r�r�r�r�r?r�r@r�s\F�
 263  
 264  
 265  ��
 266  �
 267  �� 
 268  �rc	Cs�d}ddl}tt||f�\}}||krdS|jdd�� d|�|�|�|�}|�d|�|�|���}Wd�n1s>wYz||}WntyTd}Ynwz||}	Wntyfd}	Ynwt	||g|d	||d
 269  �}
 270  z,t
 271  |�r|t
 272  |�s�t|�s�t|�r�t|�r�t|�s�t|
 273  ��WdS||ks�t|
 274  ��WdSWnt
tfy�Ynw|�||	�|�d|d�kr�t|
 275  ��dS)
aa
 276      Raises an AssertionError if two items are not equal up to significant
 277      digits.
 278  
 279      .. note:: It is recommended to use one of `assert_allclose`,
 280                `assert_array_almost_equal_nulp` or `assert_array_max_ulp`
 281                instead of this function for more consistent floating point
 282                comparisons.
 283  
 284      Given two numbers, check that they are approximately equal.
 285      Approximately equal is defined as the number of significant digits
 286      that agree.
 287  
 288      Parameters
 289      ----------
 290      actual : scalar
 291          The object to check.
 292      desired : scalar
 293          The expected object.
 294      significant : int, optional
 295          Desired precision, default is 7.
 296      err_msg : str, optional
 297          The error message to be printed in case of failure.
 298      verbose : bool, optional
 299          If True, the conflicting values are appended to the error message.
 300  
 301      Raises
 302      ------
 303      AssertionError
 304        If actual and desired are not equal up to specified precision.
 305  
 306      See Also
 307      --------
 308      assert_allclose: Compare two array_like objects for equality with desired
 309                       relative and/or absolute precision.
 310      assert_array_almost_equal_nulp, assert_array_max_ulp, assert_equal
 311  
 312      Examples
 313      --------
 314      >>> np.testing.assert_approx_equal(0.12345677777777e-20, 0.1234567e-20)
 315      >>> np.testing.assert_approx_equal(0.12345670e-20, 0.12345671e-20,
 316      ...                                significant=8)
 317      >>> np.testing.assert_approx_equal(0.12345670e-20, 0.12345672e-20,
 318      ...                                significant=8)
 319      Traceback (most recent call last):
 320          ...
 321      AssertionError:
 322      Items are not equal to 8 significant digits:
 323       ACTUAL: 1.234567e-21
 324       DESIRED: 1.2345672e-21
 325  
 326      the evaluated condition that raises the exception is
 327  
 328      >>> abs(0.12345670e-20/1e-21 - 0.12345672e-20/1e-21) >= 10**-(8-1)
 329      True
 330  
 331      TrNr_r`g�?�
 332  gz-Items are not equal to %d significant digits:)r�r!r�rH)�numpy�map�floatr^r��power�floor�log10�ZeroDivisionErrorrrbr[rPrOr�)r�r��significantr�r!rRrE�scaleZ
 333  sc_desiredZ	sc_actualrLr?r?r@r_sP;������� �r�F)�strictc	(sHd}
 334  ddlm}m}m}
m�m�m}m}m}m	}t
 335  �|�}t
 336  �|�}||}}dd�}dd�}|
df�����fd	d
 337  �	}�z�|	rM|j|jkoK|j
|j
k}n|jdkp\|jdkp\|j|jk}|s�|j|jkrqd|j�d
|j�d�}nd|j
�d
|j
�d�}t||g�|��d�d�}t|���d�}||�r�||�r�|r�||||
dd�}|r�||||�fdd�dd�O}||||�fdd�dd�O}n||�r�||�r�|r�|j
j|j
jkr�|||tdd�}|jdkr�||||}}|jdkr�WdSn|r�WdS|||�}t|t��r|}||g�}n|��}|��}|dk�r�|j|jtd�}|jdk�r-|jn|j}d||}d�|||�g} |dd���t�t��~t||�}!t
 338  �|j
t
 339  j��rgt||�}"t
 340  j |!|"|!d�||!�}#t!|!d |�|k�r~| �"d!t#|#��n	| �"d!||#���|dk�}$||$��r�|��}%n||!|$t||$��}%t!|!d |�|k�r�| �"d"t#|%��n	| �"d"||%��Wd�n	1�s�wYWd�n	1�s�wY�d#d#�$| �7�t||g���d�d�}t|��WdSt%�y#ddl&}&|&�'�}'d$|'�d%����t||g���d�d�}t%|��w)&NTr)	r�array2stringrT�inf�bool_r^�all�max�object_cS�|jjdvS)Nz?bhilqpBHILQPefdgFDG�r�r��rYr?r?r@�isnumber��z&assert_array_compare.<locals>.isnumbercSr�)Nr�r�r�r?r?r@�istime�r�z$assert_array_compare.<locals>.istime�nancs�d}||�}||�}�||k���dkr(t||g�d|��d�d�}t|��t|t�s2|jdkr6�|�St|t�s@|jdkrD�|�S|S)z�Handling nan/inf.
 341  
 342          Combine results of running func on x and y, checking that they are True
 343          at the same locations.
 344  
 345          Tz
 346  x and y %s location mismatch:�rY�y�r!r�r�r�r)r�rrPrV�bool�ndim)rYr��func�hasvalrRZx_idZy_idrL)r�r�r�r�r!r?r@�func_assert_same_pos�s"��z2assert_array_compare.<locals>.func_assert_same_posr?z	
 347  (shapes z, z
 348   mismatch)z	
 349  (dtypes r�r�F)r�r�cs
 350  |�
 351  kS�Nr?��xy�r�r?r@rG�
 352  z&assert_array_compare.<locals>.<lambda>z+infcs
 353  |�kSr�r?r�r�r?r@rGr�z-inf�NaT�r�r�z&Mismatched elements: {} / {} ({:.3g}%)r_)r���outr�zMax absolute difference: zMax relative difference: r�zerror during assertion:
 354  
 355  z
 356  
 357  )(rUrr�rTr�r�r^r�r�r�rE�
 358  asanyarray�shaper�rrPrWrr��sizerVr��ravel�sumrrm�
 359  contextlib�suppressrOr��
 360  issubdtype�unsignedinteger�minimum�getattrr��strr�r��	traceback�
 361  format_exc)(�
 362  comparisonrYr�r�r!r�r��	equal_nan�	equal_infr�rRrr�rTr^r�r�r�ZoxZoyr�r�r��cond�reasonrLZflaggedrQ�reducedZ
 363  n_mismatch�
 364  n_elementsZpercent_mismatchZremarks�errorZerror2Z
max_abs_error�nonzeroZ
max_rel_errorrZefmtr?)r�r�r�r�r�r!r@r3�s�,
 365  
 366  
 367  % ��
 368  �
 369  ��
 370  
 371  �
 372  
 373  ����
 374  ������
 375  ��+��r3c	Cs d}ttj||||d|d�dS)a�
 376      Raises an AssertionError if two array_like objects are not equal.
 377  
 378      Given two array_like objects, check that the shape is equal and all
 379      elements of these objects are equal (but see the Notes for the special
 380      handling of a scalar). An exception is raised at shape mismatch or
 381      conflicting values. In contrast to the standard usage in numpy, NaNs
 382      are compared like numbers, no assertion is raised if both objects have
 383      NaNs in the same positions.
 384  
 385      The usual caution for verifying equality with floating point numbers is
 386      advised.
 387  
 388      Parameters
 389      ----------
 390      x : array_like
 391          The actual object to check.
 392      y : array_like
 393          The desired, expected object.
 394      err_msg : str, optional
 395          The error message to be printed in case of failure.
 396      verbose : bool, optional
 397          If True, the conflicting values are appended to the error message.
 398      strict : bool, optional
 399          If True, raise an AssertionError when either the shape or the data
 400          type of the array_like objects does not match. The special
 401          handling for scalars mentioned in the Notes section is disabled.
 402  
 403      Raises
 404      ------
 405      AssertionError
 406          If actual and desired objects are not equal.
 407  
 408      See Also
 409      --------
 410      assert_allclose: Compare two array_like objects for equality with desired
 411                       relative and/or absolute precision.
 412      assert_array_almost_equal_nulp, assert_array_max_ulp, assert_equal
 413  
 414      Notes
 415      -----
 416      When one of `x` and `y` is a scalar and the other is array_like, the
 417      function checks that each element of the array_like object is equal to
 418      the scalar. This behaviour can be disabled with the `strict` parameter.
 419  
 420      Examples
 421      --------
 422      The first assert does not raise an exception:
 423  
 424      >>> np.testing.assert_array_equal([1.0,2.33333,np.nan],
 425      ...                               [np.exp(0),2.33333, np.nan])
 426  
 427      Assert fails with numerical imprecision with floats:
 428  
 429      >>> np.testing.assert_array_equal([1.0,np.pi,np.nan],
 430      ...                               [1, np.sqrt(np.pi)**2, np.nan])
 431      Traceback (most recent call last):
 432          ...
 433      AssertionError:
 434      Arrays are not equal
 435      <BLANKLINE>
 436      Mismatched elements: 1 / 3 (33.3%)
 437      Max absolute difference: 4.4408921e-16
 438      Max relative difference: 1.41357986e-16
 439       x: array([1.      , 3.141593,      nan])
 440       y: array([1.      , 3.141593,      nan])
 441  
 442      Use `assert_allclose` or one of the nulp (number of floating point values)
 443      functions for these cases instead:
 444  
 445      >>> np.testing.assert_allclose([1.0,np.pi,np.nan],
 446      ...                            [1, np.sqrt(np.pi)**2, np.nan],
 447      ...                            rtol=1e-10, atol=0)
 448  
 449      As mentioned in the Notes section, `assert_array_equal` has special
 450      handling for scalars. Here the test checks that each value in `x` is 3:
 451  
 452      >>> x = np.full((2, 5), fill_value=3)
 453      >>> np.testing.assert_array_equal(x, 3)
 454  
 455      Use `strict` to raise an AssertionError when comparing a scalar with an
 456      array:
 457  
 458      >>> np.testing.assert_array_equal(x, 3, strict=True)
 459      Traceback (most recent call last):
 460          ...
 461      AssertionError:
 462      Arrays are not equal
 463      <BLANKLINE>
 464      (shapes (2, 5), () mismatch)
 465       x: array([[3, 3, 3, 3, 3],
 466             [3, 3, 3, 3, 3]])
 467       y: array(3)
 468  
 469      The `strict` parameter also ensures that the array data types match:
 470  
 471      >>> x = np.array([2, 2, 2])
 472      >>> y = np.array([2., 2., 2.], dtype=np.float32)
 473      >>> np.testing.assert_array_equal(x, y, strict=True)
 474      Traceback (most recent call last):
 475          ...
 476      AssertionError:
 477      Arrays are not equal
 478      <BLANKLINE>
 479      (dtypes int64, float32 mismatch)
 480       x: array([2, 2, 2])
 481       y: array([2., 2., 2.], dtype=float32)
 482      TzArrays are not equal)r�r!r�r�N)r3�operator�__eq__)rYr�r�r!r�rRr?r?r@ris
 483  m
 484  �rc	shd}ddlm�m�m�m}ddlm�ddlm�������fdd�}t	|||||d��d	�d
 485  S)a�
 486  
 487      Raises an AssertionError if two objects are not equal up to desired
 488      precision.
 489  
 490      .. note:: It is recommended to use one of `assert_allclose`,
 491                `assert_array_almost_equal_nulp` or `assert_array_max_ulp`
 492                instead of this function for more consistent floating point
 493                comparisons.
 494  
 495      The test verifies identical shapes and that the elements of ``actual`` and
 496      ``desired`` satisfy.
 497  
 498          ``abs(desired-actual) < 1.5 * 10**(-decimal)``
 499  
 500      That is a looser test than originally documented, but agrees with what the
 501      actual implementation did up to rounding vagaries. An exception is raised
 502      at shape mismatch or conflicting values. In contrast to the standard usage
 503      in numpy, NaNs are compared like numbers, no assertion is raised if both
 504      objects have NaNs in the same positions.
 505  
 506      Parameters
 507      ----------
 508      x : array_like
 509          The actual object to check.
 510      y : array_like
 511          The desired, expected object.
 512      decimal : int, optional
 513          Desired precision, default is 6.
 514      err_msg : str, optional
 515        The error message to be printed in case of failure.
 516      verbose : bool, optional
 517          If True, the conflicting values are appended to the error message.
 518  
 519      Raises
 520      ------
 521      AssertionError
 522          If actual and desired are not equal up to specified precision.
 523  
 524      See Also
 525      --------
 526      assert_allclose: Compare two array_like objects for equality with desired
 527                       relative and/or absolute precision.
 528      assert_array_almost_equal_nulp, assert_array_max_ulp, assert_equal
 529  
 530      Examples
 531      --------
 532      the first assert does not raise an exception
 533  
 534      >>> np.testing.assert_array_almost_equal([1.0,2.333,np.nan],
 535      ...                                      [1.0,2.333,np.nan])
 536  
 537      >>> np.testing.assert_array_almost_equal([1.0,2.33333,np.nan],
 538      ...                                      [1.0,2.33339,np.nan], decimal=5)
 539      Traceback (most recent call last):
 540          ...
 541      AssertionError:
 542      Arrays are not almost equal to 5 decimals
 543      <BLANKLINE>
 544      Mismatched elements: 1 / 3 (33.3%)
 545      Max absolute difference: 6.e-05
 546      Max relative difference: 2.57136612e-05
 547       x: array([1.     , 2.33333,     nan])
 548       y: array([1.     , 2.33339,     nan])
 549  
 550      >>> np.testing.assert_array_almost_equal([1.0,2.33333,np.nan],
 551      ...                                      [1.0,2.33333, 5], decimal=5)
 552      Traceback (most recent call last):
 553          ...
 554      AssertionError:
 555      Arrays are not almost equal to 5 decimals
 556      <BLANKLINE>
 557      x and y nan location mismatch:
 558       x: array([1.     , 2.33333,     nan])
 559       y: array([1.     , 2.33333, 5.     ])
 560  
 561      Tr)�number�float_�result_typer)r�)�anyc	s�z<�t|��s
�t|��r;t|�}t|�}||k��sWdS|j|jkr*dkr1nn||kWS||}||}WnttfyGYnw�|d�}t�||�}t||�}�|j��sd|�	��}|dd�kS)NFrHg�?r�r�)
 562  rer�r�rOr�rEr�r�r��astype)rYr�ZxinfidZyinfidr��z�r�rr�Znpanyrrr?r@�compare/s(
 563  
 564  
 565  ��
 566  
 567  z*assert_array_almost_equal.<locals>.comparer�)r�r!r�r�N)
 568  rUrrrr�numpy.core.numerictypesr��numpy.core.fromnumericrr3)rYr�r�r�r!rRrrr?rr@r�sN
 569  �rc	Cs d}ttj||||ddd�dS)ag
 570      Raises an AssertionError if two array_like objects are not ordered by less
 571      than.
 572  
 573      Given two array_like objects, check that the shape is equal and all
 574      elements of the first object are strictly smaller than those of the
 575      second object. An exception is raised at shape mismatch or incorrectly
 576      ordered values. Shape mismatch does not raise if an object has zero
 577      dimension. In contrast to the standard usage in numpy, NaNs are
 578      compared, no assertion is raised if both objects have NaNs in the same
 579      positions.
 580  
 581  
 582  
 583      Parameters
 584      ----------
 585      x : array_like
 586        The smaller object to check.
 587      y : array_like
 588        The larger object to compare.
 589      err_msg : string
 590        The error message to be printed in case of failure.
 591      verbose : bool
 592          If True, the conflicting values are appended to the error message.
 593  
 594      Raises
 595      ------
 596      AssertionError
 597        If actual and desired objects are not equal.
 598  
 599      See Also
 600      --------
 601      assert_array_equal: tests objects for equality
 602      assert_array_almost_equal: test objects for equality up to precision
 603  
 604  
 605  
 606      Examples
 607      --------
 608      >>> np.testing.assert_array_less([1.0, 1.0, np.nan], [1.1, 2.0, np.nan])
 609      >>> np.testing.assert_array_less([1.0, 1.0, np.nan], [1, 2.0, np.nan])
 610      Traceback (most recent call last):
 611          ...
 612      AssertionError:
 613      Arrays are not less-ordered
 614      <BLANKLINE>
 615      Mismatched elements: 1 / 3 (33.3%)
 616      Max absolute difference: 1.
 617      Max relative difference: 0.5
 618       x: array([ 1.,  1., nan])
 619       y: array([ 1.,  2., nan])
 620  
 621      >>> np.testing.assert_array_less([1.0, 4.0], 3)
 622      Traceback (most recent call last):
 623          ...
 624      AssertionError:
 625      Arrays are not less-ordered
 626      <BLANKLINE>
 627      Mismatched elements: 1 / 2 (50%)
 628      Max absolute difference: 2.
 629      Max relative difference: 0.66666667
 630       x: array([1., 4.])
 631       y: array(3)
 632  
 633      >>> np.testing.assert_array_less([1.0, 2.0, 3.0], [4])
 634      Traceback (most recent call last):
 635          ...
 636      AssertionError:
 637      Arrays are not less-ordered
 638      <BLANKLINE>
 639      (shapes (3,), (1,) mismatch)
 640       x: array([1., 2., 3.])
 641       y: array([4])
 642  
 643      TzArrays are not less-orderedF)r�r!r�rN)r3r�__lt__)rYr�r�r!rRr?r?r@rNsL
 644  �rcCst||�dSr�)�exec)�astrr�r?r?r@r �sr cCstd}ddl}t|t�sttt|����t|t�s ttt|����||kr&dSt|���|�	d�|�	d���}g}|r�|�
 645  d�}|�d�rEq8|�d�r�|g}|�
 646  d�}|�d�ra|�|�|�
 647  d�}|�d�sltt|���|�|�|r�|�
 648  d�}	|	�d�r�|�|	�n|�
d|	�|dd�|dd�kr�q8|�|�q8tt|���|s�dSd	d
 649  �|�����}
 650  ||kr�t|
 651  ��dS)a�
 652      Test if two strings are equal.
 653  
 654      If the given strings are equal, `assert_string_equal` does nothing.
 655      If they are not equal, an AssertionError is raised, and the diff
 656      between the strings is shown.
 657  
 658      Parameters
 659      ----------
 660      actual : str
 661          The string to test for equality against the expected string.
 662      desired : str
 663          The expected string.
 664  
 665      Examples
 666      --------
 667      >>> np.testing.assert_string_equal('abc', 'abc')
 668      >>> np.testing.assert_string_equal('abc', 'abcd')
 669      Traceback (most recent call last):
 670        File "<stdin>", line 1, in <module>
 671      ...
 672      AssertionError: Differences in strings:
 673      - abc+ abcd?    +
 674  
 675      TrNz  z- z? z+ �zDifferences in strings:
 676  rN)�difflibrVrrPr�rWr��Differrr��pop�
 677  startswithr��insert�extendr��rstrip)r�r�rRr�diffZ	diff_list�d1r��d2�d3rLr?r?r@r�sR
 678  
 679  �
 680  
 681  
 682  
 683  
 684  
 685  
 686  
 687  
 688  
 689  
 690  
 691  �rcs�ddlm}ddl}|durt�d�}|jd}tj�tj�	|��d}|||�}|�
 692  ��|�}|jdd�}g�|rA�fdd	�}	nd}	|D]	}
 693  |j
|
 694  |	d
 695  �qE|jdkr_|ratdd�����dSdS)
aV
 696      Run doctests found in the given file.
 697  
 698      By default `rundocs` raises an AssertionError on failure.
 699  
 700      Parameters
 701      ----------
 702      filename : str
 703          The path to the file for which the doctests are run.
 704      raise_on_error : bool
 705          Whether to raise an AssertionError when a doctest fails. Default is
 706          True.
 707  
 708      Notes
 709      -----
 710      The doctests can be run by the user/developer by adding the ``doctests``
 711      argument to the ``test()`` call. For example, to run all tests (including
 712      doctests) for `numpy.lib`:
 713  
 714      >>> np.lib.test(doctests=True)  # doctest: +SKIP
 715      r)�exec_mod_from_locationNrH�__file__Fr�cs
 716  ��|�Sr�)r�)�s�rLr?r@rGr�zrundocs.<locals>.<lambda>r�zSome doctests failed:
 717  %sr�)�numpy.distutils.misc_utilr'�doctest�sys�	_getframe�	f_globals�osro�splitext�basename�
DocTestFinderr��
DocTestRunner�run�failuresrPr�)�filename�raise_on_errorr'r,r��name�m�tests�runnerr��testr?r*r@r�s$
 718  
 719  
 720  �rcGst�}|jj|�S)aDecorator to check for raised exceptions.
 721  
 722      The decorated test function must raise one of the passed exceptions to
 723      pass.  If you want to test many assertions about exceptions in a single
 724      test, you may want to use `assert_raises` instead.
 725  
 726      .. warning::
 727         This decorator is nose specific, do not use it if you are using a
 728         different test framework.
 729  
 730      Parameters
 731      ----------
 732      args : exceptions
 733          The test passes if any of the passed exceptions is raised.
 734  
 735      Raises
 736      ------
 737      AssertionError
 738  
 739      Examples
 740      --------
 741  
 742      Usage::
 743  
 744          @raises(TypeError, ValueError)
 745          def test_raises_type_error():
 746              raise TypeError("This test passes")
 747  
 748          @raises(Exception)
 749          def test_that_fails_by_passing():
 750              pass
 751  
 752      )rM�toolsr)r�rIr?r?r@rs"rc@seZdZdd�ZdS)�_DummycCsdSr�r?)�selfr?r?r@�nopFsz
 753  _Dummy.nopN)r;r<r=rAr?r?r?r@r?Esr?rAcOsd}tj|i|��S)a�
 754      assert_raises(exception_class, callable, *args, **kwargs)
 755      assert_raises(exception_class)
 756  
 757      Fail unless an exception of class exception_class is thrown
 758      by callable when invoked with arguments args and keyword
 759      arguments kwargs. If a different type of exception is
 760      thrown, it will not be caught, and the test case will be
 761      deemed to have suffered an error, exactly as for an
 762      unexpected exception.
 763  
 764      Alternatively, `assert_raises` can be used as a context manager:
 765  
 766      >>> from numpy.testing import assert_raises
 767      >>> with assert_raises(ZeroDivisionError):
 768      ...     1 / 0
 769  
 770      is equivalent to
 771  
 772      >>> def div(x, y):
 773      ...     return x / y
 774      >>> assert_raises(ZeroDivisionError, div, 1, 0)
 775  
 776      T)�_d�assertRaises)r��kwargsrRr?r?r@rKsrcOsd}tj||g|�Ri|��S)a�
 777      assert_raises_regex(exception_class, expected_regexp, callable, *args,
 778                          **kwargs)
 779      assert_raises_regex(exception_class, expected_regexp)
 780  
 781      Fail unless an exception of class exception_class and with message that
 782      matches expected_regexp is thrown by callable when invoked with arguments
 783      args and keyword arguments kwargs.
 784  
 785      Alternatively, can be used as a context manager like `assert_raises`.
 786  
 787      Notes
 788      -----
 789      .. versionadded:: 1.9.0
 790  
 791      T)rB�assertRaisesRegex)Zexception_classZexpected_regexpr�rDrRr?r?r@r%hsr%c	s�|dur
t�dtj�}nt�|�}|j}ddlm��fdd�|��D�}|D],}zt|d�r4|j	}n|j
 792  }Wn	tyAYq(w|�|�rT|�
d�sTt||||��q(dS)	a
 793      Apply a decorator to all methods in a class matching a regular expression.
 794  
 795      The given decorator is applied to all public methods of `cls` that are
 796      matched by the regular expression `testmatch`
 797      (``testmatch.search(methodname)``). Methods that are private, i.e. start
 798      with an underscore, are ignored.
 799  
 800      Parameters
 801      ----------
 802      cls : class
 803          Class whose methods to decorate.
 804      decorator : function
 805          Decorator to apply to methods
 806      testmatch : compiled regexp or str, optional
 807          The regular expression. Default value is None, in which case the
 808          nose default (``re.compile(r'(?:^|[\b_\.%s-])[Tt]est' % os.sep)``)
 809          is used.
 810          If `testmatch` is a string, it is compiled to a regular expression
 811          first.
 812  
 813      Nz(?:^|[\\b_\\.%s-])[Tt]estr��
 814  isfunctioncsg|]}�|�r|�qSr?r?)�.0�_mrFr?r@�
 815  <listcomp>�sz$decorate_methods.<locals>.<listcomp>�compat_func_name�_)�re�compiler0�sep�__dict__�inspectrG�values�hasattrrKr;�AttributeError�searchr�setattr)�cls�	decoratorZ	testmatchZcls_attr�methods�function�funcnamer?rFr@r}s&
 816  
 817  ���rrHc	Cslt�d�}|j|j}}t|d|�d�d�}d}t�}||kr-|d7}t|||�||kst�|}d|S)aG
 818      Return elapsed time for executing code in the namespace of the caller.
 819  
 820      The supplied code string is compiled with the Python builtin ``compile``.
 821      The precision of the timing is 10 milli-seconds. If the code will execute
 822      fast on this timescale, it can be executed many times to get reasonable
 823      timing accuracy.
 824  
 825      Parameters
 826      ----------
 827      code_str : str
 828          The code to be timed.
 829      times : int, optional
 830          The number of times the code is executed. Default is 1. The code is
 831          only compiled once.
 832      label : str, optional
 833          A label to identify `code_str` with. This is passed into ``compile``
 834          as the second argument (for run-time error messages).
 835  
 836      Returns
 837      -------
 838      elapsed : float
 839          Total elapsed time in seconds for executing `code_str` `times` times.
 840  
 841      Examples
 842      --------
 843      >>> times = 10
 844      >>> etime = np.testing.measure('for i in range(1000): np.sqrt(i**2)', times=times)
 845      >>> print("Time for a single execution : ", etime / times, "s")  # doctest: +SKIP
 846      Time for a single execution :  0.005 s
 847  
 848      rHzTest name: rxrrg{�G�z�?)r-r.�f_localsr/rNrr)	�code_str�times�label�frame�locs�globs�coder��elapsedr?r?r@r"�s
 849  !�
 850  r"c	Cs�tsdSddl}ddl}|�d��dd�}|}d}|��z"t�|�}td�D]}|||�}q't	t�|�|k�W|�
 851  �~dS|�
 852  �w)zg
 853      Check that ufuncs don't mishandle refcount of object `1`.
 854      Used in a few regression tests.
 855      TrNi'r�rH�)r0�gcr�r�reshape�disabler-rCr�r#�enable)	�oprfrE�b�cr��rc�j�dr?r?r@�_assert_valid_refcount�s 
 856  
 857  �rp�H�����z>c
 858  	sfd}ddl�����fdd�}��|���|�}}d�d�d�d��}	t|||t|�||	�d	�dS)
 859  a�
 860      Raises an AssertionError if two objects are not equal up to desired
 861      tolerance.
 862  
 863      Given two array_like objects, check that their shapes and all elements
 864      are equal (but see the Notes for the special handling of a scalar). An
 865      exception is raised if the shapes mismatch or any values conflict. In 
 866      contrast to the standard usage in numpy, NaNs are compared like numbers,
 867      no assertion is raised if both objects have NaNs in the same positions.
 868  
 869      The test is equivalent to ``allclose(actual, desired, rtol, atol)`` (note
 870      that ``allclose`` has different default values). It compares the difference
 871      between `actual` and `desired` to ``atol + rtol * abs(desired)``.
 872  
 873      .. versionadded:: 1.5.0
 874  
 875      Parameters
 876      ----------
 877      actual : array_like
 878          Array obtained.
 879      desired : array_like
 880          Array desired.
 881      rtol : float, optional
 882          Relative tolerance.
 883      atol : float, optional
 884          Absolute tolerance.
 885      equal_nan : bool, optional.
 886          If True, NaNs will compare equal.
 887      err_msg : str, optional
 888          The error message to be printed in case of failure.
 889      verbose : bool, optional
 890          If True, the conflicting values are appended to the error message.
 891  
 892      Raises
 893      ------
 894      AssertionError
 895          If actual and desired are not equal up to specified precision.
 896  
 897      See Also
 898      --------
 899      assert_array_almost_equal_nulp, assert_array_max_ulp
 900  
 901      Notes
 902      -----
 903      When one of `actual` and `desired` is a scalar and the other is
 904      array_like, the function checks that each element of the array_like
 905      object is equal to the scalar.
 906  
 907      Examples
 908      --------
 909      >>> x = [1e-5, 1e-3, 1e-1]
 910      >>> y = np.arccos(np.cos(x))
 911      >>> np.testing.assert_allclose(x, y, rtol=1e-5, atol=0)
 912  
 913      TrNcs�jjj||���d�S)N)�rtol�atolr)�core�numeric�iscloser��rsrrErrr?r@r0s�z assert_allclose.<locals>.comparezNot equal to tolerance rtol=�gz, atol=)r�r!r�r)r�r�r3r)
 914  r�r�rrrsrr�r!rRrr�r?rwr@r)�s9
 915  �r)c
 916  Cs�d}ddl}|�|�}|�|�}||�|�||k||��}|�|�||�|k�sN|�|�s4|�|�r<d|}t|��|�t||��}	d||	f}t|��dS)a�
 917      Compare two arrays relatively to their spacing.
 918  
 919      This is a relatively robust method to compare two arrays whose amplitude
 920      is variable.
 921  
 922      Parameters
 923      ----------
 924      x, y : array_like
 925          Input arrays.
 926      nulp : int, optional
 927          The maximum number of unit in the last place for tolerance (see Notes).
 928          Default is 1.
 929  
 930      Returns
 931      -------
 932      None
 933  
 934      Raises
 935      ------
 936      AssertionError
 937          If the spacing between `x` and `y` for one or more elements is larger
 938          than `nulp`.
 939  
 940      See Also
 941      --------
 942      assert_array_max_ulp : Check that all items of arrays differ in at most
 943          N Units in the Last Place.
 944      spacing : Return the distance between x and the nearest adjacent number.
 945  
 946      Notes
 947      -----
 948      An assertion is raised if the following condition is not met::
 949  
 950          abs(x - y) <= nulp * spacing(maximum(abs(x), abs(y)))
 951  
 952      Examples
 953      --------
 954      >>> x = np.array([1., 1e-10, 1e-20])
 955      >>> eps = np.finfo(x.dtype).eps
 956      >>> np.testing.assert_array_almost_equal_nulp(x, x*eps/2 + x)
 957  
 958      >>> np.testing.assert_array_almost_equal_nulp(x, x*eps + x)
 959      Traceback (most recent call last):
 960        ...
 961      AssertionError: X and Y are not equal to 1 ULP (max is 2)
 962  
 963      TrNzX and Y are not equal to %d ULPz+X and Y are not equal to %d ULP (max is %g))	r�r��spacing�wherer�r�r��	nulp_diffrP)
 964  rYr��nulprRrE�axZay�refrLZmax_nulpr?r?r@r$:s1
 965  
 966  ��r$cCs@d}ddl}t|||�}|�||k�std||�|�f��|S)ai
 967      Check that all items of arrays differ in at most N Units in the Last Place.
 968  
 969      Parameters
 970      ----------
 971      a, b : array_like
 972          Input arrays to be compared.
 973      maxulp : int, optional
 974          The maximum number of units in the last place that elements of `a` and
 975          `b` can differ. Default is 1.
 976      dtype : dtype, optional
 977          Data-type to convert `a` and `b` to if given. Default is None.
 978  
 979      Returns
 980      -------
 981      ret : ndarray
 982          Array containing number of representable floating point numbers between
 983          items in `a` and `b`.
 984  
 985      Raises
 986      ------
 987      AssertionError
 988          If one or more elements differ by more than `maxulp`.
 989  
 990      Notes
 991      -----
 992      For computing the ULP difference, this API does not differentiate between
 993      various representations of NAN (ULP difference between 0x7fc00000 and 0xffc00000
 994      is zero).
 995  
 996      See Also
 997      --------
 998      assert_array_almost_equal_nulp : Compare two arrays relatively to their
 999          spacing.
1000  
1001      Examples
1002      --------
1003      >>> a = np.linspace(0., 1., 100)
1004      >>> res = np.testing.assert_array_max_ulp(a, np.arcsin(np.sin(a)))
1005  
1006      TrNzCArrays are not almost equal up to %g ULP (max difference is %g ULP))r�r{r�rPr�)r�rk�maxulpr�rRrE�retr?r?r@r&ys*�r&cs�ddl�|r�j||d�}�j||d�}n
1007  ��|�}��|�}��||�}��|�s/��|�r3td���j|g|d�}�j|g|d�}�j|��|�<�j|��|�<|j|jksct	d|j|jf���fdd�}t
1008  |�}t
1009  |�}||||�S)anFor each item in x and y, return the number of representable floating
1010      points between them.
1011  
1012      Parameters
1013      ----------
1014      x : array_like
1015          first input array
1016      y : array_like
1017          second input array
1018      dtype : dtype, optional
1019          Data-type to convert `x` and `y` to if given. Default is None.
1020  
1021      Returns
1022      -------
1023      nulp : array_like
1024          number of representable floating point numbers between each item in x
1025          and y.
1026  
1027      Notes
1028      -----
1029      For computing the ULP difference, this API does not differentiate between
1030      various representations of NAN (ULP difference between 0x7fc00000 and 0xffc00000
1031      is zero).
1032  
1033      Examples
1034      --------
1035      # By definition, epsilon is the smallest number such as 1 + eps != 1, so
1036      # there should be exactly one ULP between 1 and 1 + eps
1037      >>> nulp_diff(1, 1 + np.finfo(x.dtype).eps)
1038      1.0
1039      rNr�z'_nulp not implemented for complex arrayz+x and y do not have the same shape: %s - %scs�j|||d�}��|�S�Nr�)r�r�)�rx�ry�vdtr#�rEr?r@�_diff�s
1040  znulp_diff.<locals>._diff)r�r��common_typer�r�rr�rTr�r��integer_repr)rYr�r��tr�r�r�r?r�r@r{�s* 
1041  
1042  
1043  �r{cCsD|�|�}|jdks|||dk||dk<|S|dkr ||}|S)NrHr)�viewr�)rYr��compr�r?r?r@�
_integer_repr�s
1044  
1045  �r�cCsxddl}|j|jkrt||j|�d��S|j|jkr$t||j|�d��S|j|jkr4t||j|�d��St	d|j����)zQReturn the signed-magnitude interpretation of the binary representation
1046      of x.rNi���i�l����zUnsupported dtype )
1047  r�r��float16r��int16r	�int32r��int64r�)rYrEr?r?r@r��sr�ccsp�d}t��(}|�|�}dVt|�dks&|durd|��nd}td|��Wd�dS1s1wYdS)NTr� when calling rNzNo warning raised)r2�recordr�rP)�
warning_classr9rR�supr��name_strr?r?r@�_assert_warns_context	s�
1048  �"�r�cOs`|st|�S|d}|dd�}t||jd��||i|��Wd�S1s)wYdS)a+
1049      Fail unless the given callable throws the specified warning.
1050  
1051      A warning of class warning_class should be thrown by the callable when
1052      invoked with arguments args and keyword arguments kwargs.
1053      If a different type of warning is thrown, it will not be caught.
1054  
1055      If called with all arguments other than the warning class omitted, may be
1056      used as a context manager:
1057  
1058          with assert_warns(SomeWarning):
1059              do_something()
1060  
1061      The ability to be used as a context manager is new in NumPy v1.11.0.
1062  
1063      .. versionadded:: 1.4.0
1064  
1065      Parameters
1066      ----------
1067      warning_class : class
1068          The class defining the warning that `func` is expected to throw.
1069      func : callable, optional
1070          Callable to test
1071      *args : Arguments
1072          Arguments for `func`.
1073      **kwargs : Kwargs
1074          Keyword arguments for `func`.
1075  
1076      Returns
1077      -------
1078      The value returned by `func`.
1079  
1080      Examples
1081      --------
1082      >>> import warnings
1083      >>> def deprecated_func(num):
1084      ...     warnings.warn("Please upgrade", DeprecationWarning)
1085      ...     return num*num
1086      >>> with np.testing.assert_warns(DeprecationWarning):
1087      ...     assert deprecated_func(4) == 16
1088      >>> # or passing a func
1089      >>> ret = np.testing.assert_warns(DeprecationWarning, deprecated_func, 4)
1090      >>> assert ret == 16
1091      rrHN�r9)r�r;)r�r�rDr�r?r?r@r's-$�r'ccs~�d}tjdd��,}t�d�dVt|�dkr-|dur!d|��nd}td|�d|����Wd�dS1s8wYdS)	NT�r��alwaysrr�rNzGot warningsr�)�warnings�catch_warnings�simplefilterr�rP)r9rRr�r�r?r?r@�_assert_no_warnings_contextJs�
1092  �"�r�cOs\|st�S|d}|dd�}t|jd��||i|��Wd�S1s'wYdS)a:
1093      Fail if the given callable produces any warnings.
1094  
1095      If called with all arguments omitted, may be used as a context manager:
1096  
1097          with assert_no_warnings():
1098              do_something()
1099  
1100      The ability to be used as a context manager is new in NumPy v1.11.0.
1101  
1102      .. versionadded:: 1.7.0
1103  
1104      Parameters
1105      ----------
1106      func : callable
1107          The callable to test.
1108      \*args : Arguments
1109          Arguments passed to `func`.
1110      \*\*kwargs : Kwargs
1111          Keyword arguments passed to `func`.
1112  
1113      Returns
1114      -------
1115      The value returned by `func`.
1116  
1117      rrHNr�)r�r;�r�rDr�r?r?r@r(Us$�r(�binary�c
1118  #s��d}d}td�D�]щt�dt�d|��D�]��|dkr����fdd�}t�f�d��d	�}||�|����d
1119  ffV|�}|||����dffV|dd	�|�d	d
�|�d��d�d
1120  ffV|d	d
�|�dd	�|��d�d�d
1121  ffV|�d	d
�|�dd	�|��d�d�dffV|�dd	�|�d	d
�|�d��d�dffV|dk�rڇ��fdd�}���fdd�}	t�f�d��d	�}||�|	�|�����d
1122  ffV|�}|||	�|�����dffV|	�}||�||�����dffV|dd	�|�d	d
�|	�d	d
�|�d���d�d
1123  ffV|d	d
�|�dd	�|	�d	d
�|��d��d�d
1124  ffV|d	d
�|�d	d
�|	�dd	�|���d�d�d
1125  ffV|�dd	�|�d	d
�|	�d	d
�|�d���d�dffV|�d	d
�|�dd	�|	�d	d
�|��d��d�dffV|�d	d
�|�d	d
�|	�dd	�|���d�d�dffVqq	d	S)a�
1126      generator producing data with different alignment and offsets
1127      to test simd vectorization
1128  
1129      Parameters
1130      ----------
1131      dtype : dtype
1132          data type to produce
1133      type : string
1134          'unary': create data for unary operations, creates one input
1135                   and output array
1136          'binary': create data for unary operations, creates two input
1137                   and output array
1138      max_size : integer
1139          maximum size of data to produce
1140  
1141      Returns
1142      -------
1143      if type is 'unary' yields one output, one input array and a message
1144      containing information on the data
1145      if type is 'binary' yields one output array, two input array and a message
1146      containing information on the data
1147  
1148      z,unary offset=(%d, %d), size=%d, dtype=%r, %sz1binary offset=(%d, %d, %d), size=%d, dtype=%r, %sr�r�unaryc�t��d��d�Sr��rr?�r��or)r?r@rG��z%_gen_alignment_data.<locals>.<lambda>r�Nzout of placezin placerHrg�aliasedr�cr�r�r�r?r�r?r@rG�r�cr�r�r�r?r�r?r@rG�r�z	in place1z	in place2)r�r�r
1149  )
1150  r�rW�max_sizeZufmtZbfmt�inpr�ro�inp1�inp2r?r�r@�_gen_alignment_dataysv�����
1151  �
1152  �
1153  �$�$�$�&�&�&����r�c@r9)r*z/Ignoring this exception due to disabled featureNr:r?r?r?r@r*�rAr*c	os4�t|i|��}z|VWt�|�dSt�|�w)z�Context manager to provide a temporary test folder.
1154  
1155      All arguments are passed as this to the underlying tempfile.mkdtemp
1156      function.
1157  
1158      N)r�shutil�rmtree)r�rD�tmpdirr?r?r@r.�s
1159  �r.c	osB�t|i|��\}}t�|�z|VWt�|�dSt�|�w)a�Context manager for temporary files.
1160  
1161      Context manager that returns the path to a closed temporary file. Its
1162      parameters are the same as for tempfile.mkstemp and are passed directly
1163      to that function. The underlying file is removed when the context is
1164      exited, so it should be closed at that time.
1165  
1166      Windows does not allow a temporary file to be opened if it is already
1167      open, so the underlying file must be closed after opening before it
1168      can be opened again.
1169  
1170      N)rr0�close�remove)r�rD�fdror?r?r@r-�s�
1171  r-cs>eZdZdZdZd
1172  �fdd�	Z�fdd�Z�fdd	�Z�ZS)r+a< Context manager that resets warning registry for catching warnings
1173  
1174      Warnings can be slippery, because, whenever a warning is triggered, Python
1175      adds a ``__warningregistry__`` member to the *calling* module.  This makes
1176      it impossible to retrigger the warning in this module, whatever you put in
1177      the warnings filters.  This context manager accepts a sequence of `modules`
1178      as a keyword argument to its constructor and:
1179  
1180      * stores and removes any ``__warningregistry__`` entries in given `modules`
1181        on entry;
1182      * resets ``__warningregistry__`` to its previous state on exit.
1183  
1184      This makes it possible to trigger any warning afresh inside the context
1185      manager without disturbing the state of warnings outside.
1186  
1187      For compatibility with Python 3.0, please consider all arguments to be
1188      keyword-only.
1189  
1190      Parameters
1191      ----------
1192      record : bool, optional
1193          Specifies whether warnings should be captured by a custom
1194          implementation of ``warnings.showwarning()`` and be appended to a list
1195          returned by the context manager. Otherwise None is returned by the
1196          context manager. The objects appended to the list are arguments whose
1197          attributes mirror the arguments to ``showwarning()``.
1198      modules : sequence, optional
1199          Sequence of modules for which to reset warnings registry on entry and
1200          restore on exit. To work correctly, all 'ignore' filters should
1201          filter by one of these modules.
1202  
1203      Examples
1204      --------
1205      >>> import warnings
1206      >>> with np.testing.clear_and_catch_warnings(
1207      ...         modules=[np.core.fromnumeric]):
1208      ...     warnings.simplefilter('always')
1209      ...     warnings.filterwarnings('ignore', module='np.core.fromnumeric')
1210      ...     # do something that raises a warning but ignore those in
1211      ...     # np.core.fromnumeric
1212      r?Fcs*t|��|j�|_i|_t�j|d�dS)Nr�)�set�union�
class_modules�modules�_warnreg_copies�super�__init__)r@r�r���	__class__r?r@r�sz!clear_and_catch_warnings.__init__cs<|jD]}t|d�r|j}|��|j|<|��qt���S�N�__warningregistry__)r�rSr��copyr��clearr��	__enter__)r@�modZmod_regr�r?r@r�s
1213  
1214  �
1215  z"clear_and_catch_warnings.__enter__csLt�j|�|jD]}t|d�r|j��||jvr#|j�|j|�q	dSr�)r��__exit__r�rSr�r�r��update)r@�exc_infor�r�r?r@r�!s
1216  
1217  
1218  
1219  ��z!clear_and_catch_warnings.__exit__)Fr?)	r;r<r=r>r�r�r�r��
__classcell__r?r?r�r@r+�s)r+c@szeZdZdZddd�Zdd�Zeddd	fd
1220  d�Zeddfdd
�Zeddfdd�Z	dd�Z
1221  dd�Zdd�dd�Zdd�Z
dS)r2a�
1222      Context manager and decorator doing much the same as
1223      ``warnings.catch_warnings``.
1224  
1225      However, it also provides a filter mechanism to work around
1226      https://bugs.python.org/issue4180.
1227  
1228      This bug causes Python before 3.4 to not reliably show warnings again
1229      after they have been ignored once (even within catch_warnings). It
1230      means that no "ignore" filter can be used easily, since following
1231      tests might need to see the warning. Additionally it allows easier
1232      specificity for testing warnings and can be nested.
1233  
1234      Parameters
1235      ----------
1236      forwarding_rule : str, optional
1237          One of "always", "once", "module", or "location". Analogous to
1238          the usual warnings module filter mode, it is useful to reduce
1239          noise mostly on the outmost level. Unsuppressed and unrecorded
1240          warnings will be forwarded based on this rule. Defaults to "always".
1241          "location" is equivalent to the warnings "default", match by exact
1242          location the warning warning originated from.
1243  
1244      Notes
1245      -----
1246      Filters added inside the context manager will be discarded again
1247      when leaving it. Upon entering all filters defined outside a
1248      context will be applied automatically.
1249  
1250      When a recording filter is added, matching warnings are stored in the
1251      ``log`` attribute as well as in the list returned by ``record``.
1252  
1253      If filters are added and the ``module`` keyword is given, the
1254      warning registry of this module will additionally be cleared when
1255      applying it, entering the context, or exiting it. This could cause
1256      warnings to appear a second time after leaving the context if they
1257      were configured to be printed once (default) and were already
1258      printed before the context was entered.
1259  
1260      Nesting this context manager will work as expected when the
1261      forwarding rule is "always" (default). Unfiltered and unrecorded
1262      warnings will be passed out and be matched by the outer level.
1263      On the outmost level they will be printed (or caught by another
1264      warnings context). The forwarding rule argument can modify this
1265      behaviour.
1266  
1267      Like ``catch_warnings`` this context manager is not threadsafe.
1268  
1269      Examples
1270      --------
1271  
1272      With a context manager::
1273  
1274          with np.testing.suppress_warnings() as sup:
1275              sup.filter(DeprecationWarning, "Some text")
1276              sup.filter(module=np.ma.core)
1277              log = sup.record(FutureWarning, "Does this occur?")
1278              command_giving_warnings()
1279              # The FutureWarning was given once, the filtered warnings were
1280              # ignored. All other warnings abide outside settings (may be
1281              # printed/error)
1282              assert_(len(log) == 1)
1283              assert_(len(sup.log) == 1)  # also stored in log attribute
1284  
1285      Or as a decorator::
1286  
1287          sup = np.testing.suppress_warnings()
1288          sup.filter(module=np.ma.core)  # module must match exactly
1289          @sup
1290          def some_function():
1291              # do something which causes a warning in np.ma.core
1292              pass
1293      r�cCs&d|_g|_|dvrtd��||_dS)NF>�location�once�moduler�zunsupported forwarding rule.)�_entered�
_suppressionsr��_forwarding_rule)r@Zforwarding_ruler?r?r@r�ts
1294  
1295  zsuppress_warnings.__init__cCs:ttd�rt��dS|jD]}t|d�r|j��qdS)N�_filters_mutatedr�)rSr�r��_tmp_modulesr�r�)r@r�r?r?r@�_clear_registries~s
1296  
1297  
1298  
1299  ��z#suppress_warnings._clear_registriesrNNFcCs�|rg}nd}|jrE|durtjd||d�n|j�dd�d}tjd|||d�|j�|�|��|j�	||t
1300  �|t
1301  j�||f�|S|j
�	||t
1302  �|t
1303  j�||f�|S)Nr���category�message�.�\.�$�r�r�r�)r�r��filterwarningsr;�replacer��addr��_tmp_suppressionsr�rMrN�Ir�)r@r�r�r�r��module_regexr?r?r@�_filter�s.�����zsuppress_warnings._filtercCs|j|||dd�dS)a�
1304          Add a new suppressing filter or apply it if the state is entered.
1305  
1306          Parameters
1307          ----------
1308          category : class, optional
1309              Warning class to filter
1310          message : string, optional
1311              Regular expression matching the warning message.
1312          module : module, optional
1313              Module to filter for. Note that the module (and its file)
1314              must match exactly and cannot be a submodule. This may make
1315              it unreliable for external modules.
1316  
1317          Notes
1318          -----
1319          When added within a context, filters are only added inside
1320          the context and will be forgotten when the context is exited.
1321          F�r�r�r�r�N�r��r@r�r�r�r?r?r@�filter�s
1322  
1323  �zsuppress_warnings.filtercCs|j|||dd�S)ai
1324          Append a new recording filter or apply it if the state is entered.
1325  
1326          All warnings matching will be appended to the ``log`` attribute.
1327  
1328          Parameters
1329          ----------
1330          category : class, optional
1331              Warning class to filter
1332          message : string, optional
1333              Regular expression matching the warning message.
1334          module : module, optional
1335              Module to filter for. Note that the module (and its file)
1336              must match exactly and cannot be a submodule. This may make
1337              it unreliable for external modules.
1338  
1339          Returns
1340          -------
1341          log : list
1342              A list which will be filled with all matched warnings.
1343  
1344          Notes
1345          -----
1346          When added within a context, filters are only added inside
1347          the context and will be forgotten when the context is exited.
1348          Tr�r�r�r?r?r@r��s
1349  �zsuppress_warnings.recordcCs�|jrtd��tj|_tj|_|jdd�t_d|_g|_t�|_	t�|_
1350  g|_|jD]5\}}}}}|dur;|dd�=|durHtj
d||d�q+|j�dd�d}tj
d|||d�|j	�|�q+|jt_|��|S)	Nz%cannot enter suppress_warnings twice.Tr�r�r�r�r�r�)r��RuntimeErrorr��showwarning�
1351  _orig_show�filters�_filtersr�r�r��
1352  _forwarded�logr�r�r;r�r��_showwarningr�)r@�cat�messrLr�r�r�r?r?r@r��s4
1353  ��zsuppress_warnings.__enter__cGs*|jt_|jt_|��d|_|`|`dS)NF)r�r�r�r�r�r�r�)r@r�r?r?r@r��szsuppress_warnings.__exit__)�use_warnmsgcOs�|j|jddd�D]Z\}}	}
1354  }}t||�re|
1355  �|jd�dure|durB|dur?t||||fi|��}
|j�|
�|�|
�dS|j�	|�re|durbt||||fi|��}
|j�|
�|�|
�dSq|j
1356  dkr�|dur�|j||||g|�Ri|��dS|�|�dS|j
1357  dkr�|j|f}n|j
1358  dkr�|j||f}n|j
1359  dkr�|j|||f}||j
vr�dS|j
�|�|dur�|j||||g|�Ri|��dS|�|�dS)Nrgrr�r�r�r�)r�r��
1360  issubclass�matchr�rr�r�r(rr�r�Z
_orig_showmsgr�r�)r@r�r�r7�linenor�r�rDr�rL�patternr��recrL�	signaturer?r?r@r�	sb�
1361  ��
1362  ��
1363  �
1364  ��
1365  �
1366  
1367  
1368  
1369  
1370  �zsuppress_warnings._showwarningcst����fdd��}|S)z_
1371          Function decorator to apply certain suppressions to a whole
1372          function.
1373          cs6���|i|��Wd�S1swYdSr�r?)r�rD�r�r@r?r@�new_func8	s$�z,suppress_warnings.__call__.<locals>.new_func�r)r@r�r�r?r�r@�__call__3	szsuppress_warnings.__call__)r�)r;r<r=r>r�r��Warningr�r�r�r�r�r�r�r?r?r?r@r2*s
1374  I
1375   	�3r2c
1376  cs�d}ts
1377  dVdStt���t��t��}z8td�D]
1378  }t��dkr'nqtd��t�	tj
1379  �dVt��}tjdd�}Wtjdd�=t�	|�t��ntjdd�=t�	|�t��w|r�|durld|��nd}t
d�||t|�d�dd	�|D�����dS)
1380  NTr�rz]Unable to fully collect garbage - perhaps a __del__ method is creating more reference cycles?r�rNzXReference cycles were found{}: {} objects were collected, of which {} are shown below:{}c	ss6�|]}d�t|�jt|�t�|��dd��VqdS)z
1381    {} object with id={}:
1382      {}r�z
1383      N)rmrWr;�idr��pformatr�)rHr�r?r?r@�	<genexpr>i	s���
1384  �z/_assert_no_gc_cycles_context.<locals>.<genexpr>)r0r#rf�	isenabledrh�	get_debugr��collectr��	set_debugZ
DEBUG_SAVEALL�garbagerirPrmr�r�)r9rRZgc_debugr�Zn_objects_in_cyclesZobjects_in_cyclesr�r?r?r@�_assert_no_gc_cycles_context@	sP���
1385  
1386  �
1387  
1388  
1389  ����r�cOs^|st�S|d}|dd�}t|jd��||i|��Wd�dS1s(wYdS)a3
1390      Fail if the given callable produces any reference cycles.
1391  
1392      If called with all arguments omitted, may be used as a context manager:
1393  
1394          with assert_no_gc_cycles():
1395              do_something()
1396  
1397      .. versionadded:: 1.15.0
1398  
1399      Parameters
1400      ----------
1401      func : callable
1402          The callable to test.
1403      \*args : Arguments
1404          Arguments passed to `func`.
1405      \*\*kwargs : Kwargs
1406          Keyword arguments passed to `func`.
1407  
1408      Returns
1409      -------
1410      Nothing. The result is deliberately discarded to ensure that all cycles
1411      are found.
1412  
1413      rrHNr�)r�r;r�r?r?r@r4t	s"�r4cCs4t��trt��t��t��t��dSdS)a1
1414      Break reference cycles by calling gc.collect
1415      Objects can call other objects' methods (for instance, another object's
1416       __del__) inside their own __del__. On PyPy, the interpreter only runs
1417      between calls to gc.collect, so multiple calls are needed to completely
1418      release all cycles.
1419      N)rfr�r/r?r?r?r@r5�	s	�r5csddl���fdd�}|S)z:Decorator to skip a test if not enough memory is availablerNcst�����fdd��}|S)NcsJt��}|dur
��|�z�|i|��WSty$��d�YdSw)NzMemoryError raised)�check_free_memory�skip�MemoryError�xfail)r��kwrL)�
1420  free_bytesr��pytestr?r@�wrapper�	s
1421  �z3requires_memory.<locals>.decorator.<locals>.wrapperr��r�r�rr�r�r@rX�	sz"requires_memory.<locals>.decorator)r)rrXr?r	r@�requires_memory�	src
1422  Cs�d}tj�|�}|dur4zt|�}Wnty(}z
1423  td|�d|����d}~ww|d�d|�d�}nt�}|dur@d}d	}n|d�d
1424  |d�d�}||krR|SdS)z�
1425      Check whether `free_bytes` amount of memory is currently free.
1426      Returns: None if enough memory available, otherwise error message
1427      �NPY_AVAILABLE_MEMNzInvalid environment variable r�ge��Az@ GB memory required, but environment variable NPY_AVAILABLE_MEM=z setzCould not determine available memory; set NPY_AVAILABLE_MEM environment variable (e.g. NPY_AVAILABLE_MEM=16GB) to run the test.rgz GB memory required, but z
 GB available)r0�environ�get�_parse_sizer��_get_mem_available)r�env_varZ	env_valueZmem_freer�rLr?r?r@r�	s$��
1428  
1429  �rcCs�dddddddddddddd	d
1430  �}t�d�d�|����tj�}|�|���}|r0|�d
�|vr8t	d|�d���t
1431  t|�d��||�d
��S)z3Convert memory size strings ('12 GB' etc.) to floatrHi�i@Biʚ;lJ)��ii@l)rNrkr�r:rxr��kb�mb�gb�tbZkib�mibZgibZtibz^\s*(\d+|\d+\.\d+)\s*({0})\s*$�|rzvalue z not a valid size)rMrNrmr��keysr�r��lower�groupr�r}r�)�size_str�suffixesZsize_rer:r?r?r@r�	s��� rc	Cs�z
1432  ddl}|��jWSttfyYnwtj�d�r]i}tdd��"}|D]}|�	�}t
1433  |d�d||d�d���<q&Wd�n1sHwYd	|vrU|d	S|d
1434  |dSdS)z5Return available memory in bytes, or None if unknown.rNrvz
/proc/meminforwrHr�:ZmemavailableZmemfree�cached)
�psutil�virtual_memory�	availablerJrTr-�platformrrzr|r}�stripr)r �infor��line�pr?r?r@r�	s$�$��rcs&ttd�s�St���fdd��}|S)z�
1435      Decorator to temporarily turn off tracing for the duration of a test.
1436      Needed in tests that check refcounting, otherwise the tracing itself
1437      influences the refcounts
1438      �gettracec	s:t��}zt�d��|i|��Wt�|�St�|�wr�)r-r(�settrace)r�rDZoriginal_tracer
1439  r?r@r
1440  s
1441  
1442  z_no_tracing.<locals>.wrapper)rSr-rrr?r
1443  r@�_no_tracing
1444  s
1445  
1446  r*c
1447  CsFz
t�d��d�d}W|Sty"}z	d}WYd}~|Sd}~ww)N�CS_GNU_LIBC_VERSIONrxrH�0.0)r0�confstr�rsplitr~)�ver�instr?r?r@�_get_glibc_version
1448  s���r1cCstdkot|kS)Nr,)�	_glibcverr�r?r?r@rG!
1449  s)rN)NrgNN)rrr)r�Tr�r�)rNT)r�rNT)rNTrNr�TT)r�rNT)NTr�)rHN)rqrTrNT)rH)rr>r0r-r#rMrfrr��	functoolsrrr�r��tempfilerrZ
unittest.caserrr�r�rErUrr	r
1450  rrr
rrZnumpy.linalg.lapack_lite�ior�__all__r~r,�KnownFailureTestr!rnr1�implementationr9r/rSr7r�r0�linalg�lapack_liteZ_ilp64r6r8rMr#r[rbrerqr�getpidrrrr�_no_nep50_warningrrr3rrrr rrr�unittest�TestCaser?rBrr%rr"rpr)r$r&r{r�r��contextmanagerr�r'r�r(r�r*r.r-r�r+r2r�r4r5rrrrr*r1r2�_glibc_older_thanr?r?r?r@�<module>s�(
1451  
1452  
1453  
1454  
1455  �
14561457  !)~c��&s
1458  qS
1459  G.(
1460  
1461  /.
14621463  F
1464  ?
1465  4?
1466  6
1467  $E
1468  
1469  B3"