+
    ei'  c                   s:   R t ^ RIt^ RIt^ RIHu Ht ^ RIt^ RIHt ^ RIH	t	H
t
HtHtHt ^RIHtHtHtHtHtHt . ROt^ RIHt . ROt]],           tRR ltRR ltRR ltR	 tRR
 ltRR lt]t RR lt!]!t"RR lt#RR lt$RR lt%RR lt&RR lt'RR lt(RR lt)R# )zMiscellaneous functions for testing masked arrays and subclasses

:author: Pierre Gerard-Marchant
:contact: pierregm_at_uga_dot_edu

N)ndarray)assert_assert_allcloseassert_array_almost_equal_nulpassert_raisesbuild_err_msg)filledgetmaskmask_ormaskedmasked_arraynomask)TestCasec                s   \        \        V 4      \        V4      4      p\        V 4      p\        V4      pVP                  P                  R8X  g   VP                  P                  R8X  d%   \
        P                  ! Wg4      P                  4       # \        \        VRVR7      V4      P                  \
        P                  4      p\        \        VRVR7      ^4      P                  \
        P                  4      p	\
        P                  ! \        P                  ! W,
          4      WC\        P                  ! V	4      ,          ,           4      p
V
P                  4       # )aj  
Returns true if all components of a and b are equal to given tolerances.

If fill_value is True, masked values considered equal. Otherwise,
masked values are considered unequal.  The relative error rtol should
be positive and << 1.0 The absolute error atol comes into play for
those elements of b that are very small or zero; it says how small a
must be also.

OFcopymask)r   r   r   dtypecharnpequalravelr
   astypefloat64Z
less_equalumathZabsolute)ab
fill_valuertolZatolmd1d2xyds   &&&&&      9/usr/lib64/python3.14/site-packages/numpy/ma/testutils.pyapproxr$   -   s     	
GAJ'A	B	B	xx}}rxx}}3xx%%''Re!,j	fRZZ  	|BU3Q7>>rzzJA
ennQU+T5>>!;L4L-LMA779    c                s   \        \        V 4      \        V4      4      p\        V 4      p\        V4      pVP                  P                  R8X  g   VP                  P                  R8X  d%   \
        P                  ! WV4      P                  4       # \        \        VRVR7      V4      P                  \
        P                  4      p\        \        VRVR7      ^4      P                  \
        P                  4      p\
        P                  ! \
        P                  ! Wx,
          4      V4      RV) ,          8*  p	V	P                  4       # )z
Returns True if a and b are equal up to decimal places.

If fill_value is True, masked values considered equal. Otherwise,
masked values are considered unequal.

r   Fr         $@)r   r   r   r   r   r   r   r   r
   r   r   Zaroundabs)
r   r   decimalr   r   r   r   r    r!   r"   s
   &&&&      r#   almostr)   E   s     	
GAJ'A	B	B	xx}}rxx}}3xx%%''Re!,j	fRZZ  	|BU3Q7>>rzzJA
		"&&-)Twh-??A779r%   c           	     s    \        \        V 4      \        V4      V4       \        \        V4      4       F#  p\        W,          W,          RV: RV 24       K%  	  R# )z3
Asserts the equality of two non-array sequences.

item=
N)assert_equallenrange)actualdesirederr_msgks   &&& r#   _assert_equal_on_sequencesr3   Z   sH    
 Vc'lG43w< VY
eA57),DE !r%   c                sn   \        V P                  VP                  4       V P                  P                   Fz  p\        P                  ! W4      \        P                  ! W4      rCV\
        J d   K:  V\
        J d   KF  \        \        P                  ! W4      \        P                  ! W4      4       K|  	  R# )z=
Asserts that two records are equal.

Pretty crude for now.

N)r,   r   namesoperatorZgetitemr	   )r   r   ZfZafZbfs   &&   r#   assert_equal_recordsr6   d   sr     !''"WW]]$$Q*H,<,<Q,BRfrV|))!/1A1A!1GH r%   c           	     sR   \        V\        4      '       d   \        V \        4      '       g   \        \        \	        V 4      4      4      h\        \        V 4      \        V4      V4       VP                  4        F;  w  r4W09  d   \        V RV  24      h\        W,          W,          RV: RV 24       K=  	  R# \        V\        \        34      '       d*   \        V \        \        34      '       d   \        WRR7      # \        V \        4      '       g7   \        V\        4      '       g!   \        W.V4      pW8X  g   \        V4      hR# V \        J d   V\        J d   V\        J d&   V \        J g   \        W.VRR	R7      p\        V4      h\        P                   ! V 4      p \        P                   ! V4      pV P"                  VP"                  rvVP$                  R8X  d<   VP$                  R8X  d+   \        V P'                  4       VP'                  4       RR7      # \)        WV4      # )
z$
Asserts that two items are equal.

z not in key=r+   N r1   )headerr4   ZSr    r!   )
isinstancedictAssertionErrorreprtyper,   r-   itemslisttupler3   r    r   r	   
ValueErrorr   Z
asanyarrayr   r   Ztolistassert_array_equal)r/   r0   r1   r2   imsgZactual_dtypeZdesired_dtypes   &&&     r#   r,   r,   r   s    '4  &$'' d6l!344S[#g,8MMODA$s(6(%;<<GJ$qe2gY0GH $ 	'D%=))j$.O.O)&2FFvw'':gw+G+GV-w8  %%	6	Gv$5&F*:V-#BjBo]]6"FmmG$G%+\\7===CM$6$6#$=)&--/*1..*:246 	6 fw77r%   c           	     s|   \        V\        4      '       d   \        V \        4      '       g   \        \        \	        V 4      4      4      h\        \        V 4      \        V4      V4       VP                  4        F?  w  r4W09  d   \        \        V4      4      h\        W,          W,          RV: RV 24       KA  	  R# \        V\        \        34      '       dy   \        V \        \        34      '       d]   \        \        V 4      \        V4      V4       \        \        V4      4       F#  p\        W,          W,          RV: RV 24       K%  	  R# \        V \        P                  4      '       g!   \        V\        P                  4      '       d   \        WV4      # \        W.V4      pW8w  g   \        V4      hR# )z4
Raises an assertion error if two items are equal.

r7   r+   Nr*   )r<   r=   r>   r?   r@   fail_if_equalr-   rA   rB   rC   r.   r   r    fail_if_array_equalr   )r/   r0   r1   r2   rF   rG   s   &&&   r#   rH   rH      sI   
 '4  &$'' d6l!344c&k3w<9MMODA$T!W--&)WZ4uBwi1HI $ 	'D%=))j$.O.Oc&k3w<9s7|$A&)WZ5Ry1IJ %&"**%%GRZZ)H)H"6G<<
)7
3CS!! r%   c                s   \        V \        P                  4      '       g!   \        V\        P                  4      '       d   \        WVW4R7      # \	        W.W4R7      p\        \        W,
          4      V4      ^ 8X  g   \        V4      hR# )zr
Asserts that two items are almost equal.

The test is equivalent to abs(desired-actual) < 0.5 * 10**(-decimal).

)r(   r1   verbose)r1   rJ   N)r<   r   r    assert_array_almost_equalr   Zroundr'   r>   )r/   r0   r(   r1   rJ   rG   s   &&&&& r#   assert_almost_equalrL      st     &"**%%GRZZ)H)H('18K 	K
) ':CW%&0A5S!! 6r%   c           	     s   \        \        V4      \        V4      4      p\        VRVRRR7      p\        VRVRRR7      pV\        J d   V\        J d   V\        J d&   V\        J g   \	        W.W4VRR7      p\        V4      h\        P                  P                  V VP                  V4      VP                  V4      VWER7      # )zb
Asserts that comparison between two masked arrays is satisfied.

The comparison is elementwise.

F)r   r   Z	keep_maskZsubok)r1   rJ   r:   r4   r1   rJ   r:   r;   )
r   r   r
   r	   r   rD   r   Ztestingassert_array_comparer   )	Z
comparisonr    r!   r1   rJ   r:   r   r   rG   s	   &&&&&&&  r#   rN   rN      s     	
GAJ'AQUe5IAQUe5IA	
fqF{6kAKQFG#)=o::**:+,88J+?+,88J+?3:3:	 + K Kr%   c           	     @    \        \        P                  WW#RR7       R# )z8
Checks the elementwise equality of two masked arrays.

Arrays are not equalrM   N)rN   r5   Z__eq__r    r!   r1   rJ      &&&&r#   rE   rE      s    
 !!( 68r%   c           	     s*    R p\        W@WVRR7       R# )zL
Raises an assertion error if two masked arrays are not equal elementwise.

c                 sJ    \         P                  ! \        W4      4      '       * # )N)r   Zallr$   r;   s   &&r#   compareZ$fail_if_array_equal.<locals>.compare   s    FF6!<(()r%   rP   rM   NrN   )r    r!   r1   rJ   rS   s   &&&& r#   rI   rI      s    
*Q 68r%   c           	     2   a V3R lp\        WPWVRR7       R# )p
Checks the equality of two masked arrays, up to given number odecimals.

The equality is checked elementwise.

c                s.   < \        WRS) ,          R7      # )<Returns the result of the loose comparison between x and y).r&   )r   )r$   r    r!   r(      &&r#   rS   Z*assert_array_approx_equal.<locals>.compare   s    a11r%   Arrays are not almost equalrM   NrT   r    r!   r(   r1   rJ   rS      &&f&& r#   assert_array_approx_equalr]      s    2 Q =?r%   c           	     rU   )rV   c                s   < \        WS4      # )rW   )r)   rX   rY   r#   rS   Z*assert_array_almost_equal.<locals>.compare  s    aG$$r%   rZ   rM   NrT   r[   r\   r#   rK   rK     s    % Q =?r%   c           	     rO   )z/
Checks that x is smaller than y elementwise.

zArrays are not less-orderedrM   N)rN   r5   Z__lt__rQ   rR   r#   assert_array_lessr^     s    
 !!( =?r%   c                s    V \         J d   \        V\         J 4       V\         J d   \        V \         J 4       \        WVR7       R# )z%
Asserts the equality of two masks.

r9   N)r   r   rE   )Zm1Zm2r1   s   &&&r#   assert_mask_equalr_     s4    
 
V|f	V|frw/r%   )r)   r$   rL   rK   r]   rN   rE   r^   assert_closer,   r6   r_   assert_not_equalrI   )r   r   r   r   r   )Tgh㈵>g:0yE>)   T)r8   )i   r8   T)r8   Tr8   T)r8   T)rb   r8   T)*Z__doc__r5   Znumpyr   Znumpy._core.umathZ_corer   Znumpy.testingr    r   r   r   r   r   Zcorer   r   r   r	   r
   r   Z__all__maskedZunittestr   Z__some__from_testingZ__all__r$   r)   r3   r6   r,   rH   ra   rL   r`   rN   rE   rI   r]   rK   r^   r_   ) r%   r#   <module>rc      s      ! !    I H  
 .
.0*FI$8N"4 ! "  #K288???	0r%   