
    m[hS"                         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
mZmZmZmZmZ d dlmZ d dlmZmZmZmZ  G d deej.                        Z G d d      Z G d	 d
      Z G d d      Zy)    N)MaskedArrayMaskTypeaddallequaldividegetmaskhypotlogmaskedmasked_arraymasked_valuesnomaskmr_)assert_assert_array_equalassert_equalassert_raisesc                   ,    e Zd ZefdZd Zed        Zy)MMatrixc                 `    t        j                  |      }t        j                  | ||      }|S )N)datamask)npmatrixr   __new__)clsr   r   mat_datas        t/var/www/html/p-interativo-gestao-midia/env/lib/python3.12/site-packages/numpy/matrixlib/tests/test_masked_matrix.pyr   zMMatrix.__new__   s(    iio##Cc=    c                 p    t         j                  j                  | |       t        j                  | |       y N)r   r   __array_finalize__r   )selfobjs     r    r$   zMMatrix.__array_finalize__   s&    
		$$T3/&&tS1r!   c                 >    | j                  t              }d|_        |S )NF)viewr   _sharedmask)r%   _views     r    _serieszMMatrix._series!   s    		+&!r!   N)__name__
__module____qualname__r   r   r$   propertyr+    r!   r    r   r      s#     & 
2  r!   r   c                   <    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
y	)
TestMaskedMatrixc           
      V   t        j                  g dg dg      }t        |g dg dg      }t        |g dg dg      }t        |      }t        |       t	        |       t        t        |d         t        |d         u        t        |d   |d   k(         t        |d   t        u        t        |d   |d          t        |d	d
d f   |d	d
d f          t        |d d df   |d d df          t        |d d  |d d         t        |d
d  |d
d         d|d<   d|d<   t        ||       d|d	d
d f<   d|d	d
d f<   t        ||       t        |d<   t        ||       t        |d	d
d f<   t        ||       |d	d d f   |d	d d f<   t        |d<   t        t        t        |      t        j                  g dg dg                   t        g dg d      |d
d d f<   t        t        t        |      d
   t        g d                   t        t        t        |d
         t        g d                   t        g dg d      |d
d d f<   t        t        t        |d
         t        g d                   t        t        |d
   t        g d                   t        j                  t        j                  d      dz        }t        |d      }t        ||       t        t        t        g dt              |j                               t        d|j                          y )N         )   r7   r6   r5   r   r   )r   r5   r   r   r5   r   )r5   r5   )r   r6   r   r5   r6   	   c   )r   r5   )r5   r5   r            ?      @)r   r   r   r5   r   dtype)r   r   r   strreprr   typer   r   r   r   arrayaranger   r   r   
fill_value)r%   x1x2x3x4s        r    test_matrix_indexingz%TestMaskedMatrix.test_matrix_indexing)   s   YY	9-."Iy#9:"Iy#9:"BRRX$r$x.014BtH$%4F"#RXr$x(R12Y1ab5	*R1Xr!Q$x(RUBqE"RVRV$44R1ab5	1ab5	R4R1ab5	Rad81a44bhh	9/E&FGH	951a4Qi)@ABAi)@AB	951a4Ai)@ABAY 789YYryy|c)*2s#RoXF" 	#S"--(r!   c           	         t        t        j                  t        t	        d                  g ddz        }t	        dt
        j                  dz         D ]  }t        j                  t        j                  ||            }t        |j                  |j                         t        ||       t        t        |j                  t        j                                y )N
   )r5   r   r5   r   r   r6   r:   r5   )protocol)r   r   r   listrangepickleHIGHEST_PROTOCOLloadsdumpsr   _maskr   
isinstancer   )r%   aproto	a_pickleds       r    test_pickling_subbaseclassz+TestMaskedMatrix.test_pickling_subbaseclassU   s    4b	?3/A:MN1f559:EV\\!e%DEI!''2A&Jy		:;	 ;r!   c                    t        t        j                  ddgddgg      t        j                  d            }t	        |j                  d      j                  d	       t	        |j                  d      j                  d
       t	        |j                  d      ddgg       t	        |j                  d      dgdgg       y )Nr5   r6   r7   r8   )r6   r6   r:   r   )axis)r5   r6   )r6   r5   g       @r@   g      ?g      @)r   r   r   zerosr   countshapemean)r%   ms     r    test_count_mean_with_matrixz,TestMaskedMatrix.test_count_mean_with_matrix^   s    QFQF#34288F;KLQWW!W_**F3QWW!W_**F3 	QVVV^r2hZ0QVVV^secU^4r!   c           	         t        t        j                  g dg      g d      }t        |j                  d   d       t        |j                  d   t
               t        t        j                  |j                  dd |dddf   k(               t        t        j                  g dg      g d      }t        g dg d      |_        t        t        j                  g dg      g d      }t        ||       t        t        j                  g dg      g d      }|j                  }|g d	   |d d  t        ||       d
|d<   t        t        j                  t        j                  d            d      }|j                  }|d d }t        |j                  t        j                  ddgg             t        |j                  t        j                  ddgg             y )Nr4   )r   r   r5   r:   r5   r6   r   )r7   r6   r5   r9   )r6   r5   r   r<   r?   g        F)r   r   r   r   flatr   r   alleyer   rF   r   )r%   testcontroltestflatrY   bb01s          r    	test_flatzTestMaskedMatrix.test_flath   s^    BIIyk2CTYYq\1%TYYq\6*tyy1~a1f567BIIyk2C ;	ryy)5IFT7#BIIyk2C99y)T7#266!9-A6FFeSXXrxx"b
34SXXrxx%(89:r!   c                    t        j                  g dg dg dg      }t        j                  |      }t        j                  g dg dg dgt         j                        }t	        ||      }|d	kD  }|d	k  }t        |j                                 t        |j                                t        |j                  d
      t        j                  g d             t        |j                  d      t        j                  g d      j                         t        |j                  d
      t        j                  g d             t        |j                  d      t        j                  g d      j                         t        |j                                 t        |j                                t        |j                  d
      t        j                  g d             t        |j                  d      t        j                  g d      j                         t        |j                  d
      t        j                  g d             t        |j                  d      t        j                  g d      j                         y )N)gp=
ף?gp=
ף?g?)gQ?gQ?g)\(?)gףp=
?gףp=
?gffffff?)TFF)FFF)TTFrA   r:   g      ?r   )FFTr5   )TTT)
r   rF   r   boolr   r   rg   anyr   T)r%   xXrc   mXmXbigmXsmalls          r    test_allany_onmatricesz'TestMaskedMatrix.test_allany_onmatrices   s   HH(((* + IIaLHH*+)+24''; !!$c8EIIK 		UYYq\299-A#BCUYYq\299-A#B#D#DEUYYq\299-A#BCUYYq\299-?#@#B#BCGKKM!"W[[^RYY/B%CDW[[^RYY/D%E%G%GHW[[^RYY/B%CDW[[^RYY/B%C%E%EFr!   c                    t        t        j                  g d      g d      }|j                         }t	        ||       t        t        |t        j                               t        |d<   |j                         }t	        |g dg       y )N)r5   r6   r7   r8   )r   r   r   r   r:   )r   r   )r6   r7   r8   )r   r   r   
compressedr   r   rX   r   )r%   rY   rl   s      r    test_compressedz TestMaskedMatrix.test_compressed   s_    <0|DLLNQ
1bii()$LLNQ$r!   c                     t        t        j                  g d      g dg      }|j                         }t	        |j
                  d       t	        |j                  j
                  |j
                         y )N)r5   r6   r7   r8   r>   r   r5   r   r   r   r:   )r5   r>   )r   r   r   ravelr   ra   rW   )r%   rY   aravels      r    
test_ravelzTestMaskedMatrix.test_ravel   sK    ?3?:KLV\\6*V\\''1r!   c                    t        t        t        j                  d      t        j                  j                  d                  }t        j                  |      }t        |dt        fdt        fg      }d|j                  d<   |j                  t        dft        j                        }t        ||       t        t        |t        j                               t        t        |t                      y )NrO   rY   rl   rA   r;   r   r6   )rQ   zipr   rG   randomrandrF   r   floatr   r(   r   r   r   rX   r   )r%   iteratorr   rY   ri   s        r    	test_viewzTestMaskedMatrix.test_view   s    BIIbM299>>"+=>?xx!3,e)EFq	vvuaj")),T4 
4+,Jt[112r!   N)r,   r-   r.   rM   r\   rd   rn   rx   r{   r   r   r0   r!   r    r2   r2   (   s,    *)X<5;2G4%2	3r!   r2   c                   *    e Zd Zd Zd Zd Zd Zd Zy)TestSubclassingc                 b    t        j                  dd      }t        |g d      }||f| _        y )Nr>   r   rA   r}   r:   )r   rG   r   r   r%   rs   mxs      r    setup_methodzTestSubclassing.setup_method   s)    IIaw'Q_-G	r!   c                 |    | j                   \  }}t        t        |j                  t        j
                               y r#   )r   r   rX   r   r   r   r   s      r    test_maskedarray_subclassingz,TestSubclassing.test_maskedarray_subclassing   s&    ))B
288RYY/0r!   c                    | j                   \  }}t        j                  d      5  t        t	        t        |      t                     t        t        |      t        j
                  |             d d d        y # 1 sw Y   y xY w)Nignore)r   )r   r   errstater   rX   r
   r   r   r   s      r    test_masked_unary_operationsz,TestSubclassing.test_masked_unary_operations   sP    ))B[[)Js2w01Q+ *))s   AA::Bc                 N   | j                   \  }}t        t        t        ||      t                     t        t        t        ||      t                     t        t        ||      ||z          t        t        t        ||      j                  t        j                               t        t              5  t        j                  ||       d d d        t        t        t        ||      t                     t        t        t        ||      t                     y # 1 sw Y   PxY wr#   )r   r   rX   r   r   r   r   r   r   r   	TypeErrorouterr	   r   s      r    test_masked_binary_operationsz-TestSubclassing.test_masked_binary_operations   s    ))B
3r2;01
3r1:w/0SQZa(
3r2;,,bii899%IIb" &
5R='23
5Q<12 &%s   5DD$c                 L   | j                   \  }}t        |j                   j                         |j                        }t	        t        t        ||      t                     t	        t        t        ||      t                     t        t        ||      t        ||             y )Nr:   )	r   r   	__array__r   r   rX   r   r   r   )r%   rs   r   xmxs       r    test_masked_binary_operations2z.TestSubclassing.test_masked_binary_operations2   sm    ))B277,,.RWW=
6"b>734
6"a='23VB^VC%56r!   N)r,   r-   r.   r   r   r   r   r   r0   r!   r    r   r      s    
1
,37r!   r   c                       e Zd Zd Zd Zy)TestConcatenatorc                 N    t        t        j                  j                  d        y )Nc                      t         d   S )Nz
1, 2; 3, 4r   r0   r!   r    <lambda>z6TestConcatenator.test_matrix_builder.<locals>.<lambda>   s	    S->r!   )r   r   maMAError)r%   s    r    test_matrix_builderz$TestConcatenator.test_matrix_builder   s    beemm%>?r!   c                 .   t         d   }t        j                  j                  t        j                  d         }t        ||       t        t        |      t        |             t        t        |j                        t        |j                               y )N)rr5   r6   r7   )	r   r   r   rF   r_r   r   rE   r   )r%   actualexpecteds      r    test_matrixzTestConcatenator.test_matrix   sc     \"55;;ruu\2368, 	T&\4>2T&++&X]](;<r!   N)r,   r-   r.   r   r   r0   r!   r    r   r      s    @
=r!   r   )rS   numpyr   numpy.ma.corer   r   r   r   r   r   r	   r
   r   r   r   r   numpy.ma.extrasr   numpy.ma.testutilsr   r   r   r   r   r   r2   r   r   r0   r!   r    <module>r      s^           W Wk299 $K3 K3\(7 (7T= =r!   