
    shW                     X    S SK rS SKJr  S SKJr  S SKJr  S SKJ	r	  S r
 " S S\	5      rg)	    N)njit)types)TypingError)TestCasec                    ^ ^ U U4S jnU$ )Nc                 2   > T" U 5      R                  T5      $ Nview)xabs    l/Users/tiagomarins/Projetos/claudeai/copy_bank/venv/lib/python3.13/site-packages/numba/tests/test_numbers.pyimplgen_view.<locals>.impl   s    tyy|     )r   r   r   s   `` r   gen_viewr      s    Kr   c                   H    \ rS rSrSrS rS rS rS rS r	S r
S	 rS
 rSrg)TestViewIntFloat   z/This tests the 'view' method on NumPy scalars. c           	         U H  u  p4n[        X%5       H  u  pg[        [        XF5      5      n[        R                  " U5      (       dG  U R                  U" U5      U" U5      5        U R                  U" U5      UR                  U5      5        M{  U R                  [        R                  " U" U5      5      5        U R                  [        R                  " UR                  U5      5      5        M     M     g r	   )zipr   r   npisnanassertEqualpy_func
assertTrue)	selfinputsdtypesvalueinitial_typeexpectedtarget_typeresultr   s	            r   
do_testingTestViewIntFloat.do_testing   s    -3)E'*6'<#H\?@xx''$$T%[+f2EF$$T%[%)\\%%8: OOBHHT%[$9:OOBHHT\\%-@$AB (= .4r   c                     [         R                  [         R                  4nS[         R                  S4S[         R                  S44nU R                  X!5        g )N   )r*   r*   )   r+   )r   uint8int8r'   r   r!   r    s      r   test_8_bitsTestViewIntFloat.test_8_bits$   sC    ((BGG$V,Y/1'r   c                    [         R                  [         R                  [         R                  4nS[         R                  S4S[         R                  SS[         R                  44S[         R                  S44nU R                  X!5        g )Nr*   )r*   r*   g      6r+   l          ?)  ?r4   r3   )r   uint32int32float32nanr'   r/   s      r   test_32_bitsTestViewIntFloat.test_32_bits+   sg    ))RXXrzz2		&CDz2rvv&>?

&CDF 	'r   c                    [         R                  [         R                  [         R                  4nS[         R                  S4S[         R                  SS[         R                  44S[         R                  S44nU R                  X!5        g )Nr*   )r*   r*   g       r+   l    r3   )          r<   r3   )r   uint64int64float64r8   r'   r/   s      r   test_64_bitsTestViewIntFloat.test_64_bits3   sj    ))RXXrzz2		n5';R&HI

 ', - 	'r   c                 H  ^ [        [        SR                  [        R                  R
                  5      5      m[        U4S j5       nU R                  [        5       nU" 5         S S S 5        U R                  S[        WR                  5      5        g ! , (       d  f       N4= f)Nzint{}c                  ,   > Sn U R                  T5        g )Nr*   r
   )r   inttys    r   myview=TestViewIntFloat.test_python_scalar_exception.<locals>.myviewA   s    AFF5Mr   z\'view' can only be called on NumPy dtypes, try wrapping the variable 'a' with 'np.<dtype>()')getattrr   formatr   intpbitwidthr   assertRaisesr   assertInstr	exception)r   rE   erD   s      @r   test_python_scalar_exception-TestViewIntFloat.test_python_scalar_exception>   sw    GNN5::+>+>?@		 
	 {+qH , J!++&	( ,+s   B
B!c                     U R                  [        5       n[        [        US   US   5      5      nU" S5        S S S 5        U R	                  S[        WR                  5      5        g ! , (       d  f       N4= f)Nr   r*   zOChanging the dtype of a 0d array is only supported if the itemsize is unchanged)rK   r   r   r   rL   rM   rN   )r   pairrO   r   s       r   do_testing_exceptions&TestViewIntFloat.do_testing_exceptionsL   s_    {+qa$q'23DG , 	 5!++&	( ,+s   $A((
A6c                     [         R                  [         R                  4[         R                  [         R                  44 H  nU R                  U5        M     g r	   )r   r6   r.   rT   r   rS   s     r   test_exceptions32"TestViewIntFloat.test_exceptions32T   s9    hh(277BHH*=>D&&t, ?r   c                     [         R                  [         R                  4[         R                  [         R                  44 H  nU R                  U5        M     g r	   )r   r6   r>   rT   rW   s     r   test_exceptions64"TestViewIntFloat.test_exceptions64X   s:    hh)BHHbhh+?@D&&t, Ar   r   N)__name__
__module____qualname____firstlineno____doc__r'   r0   r9   r@   rP   rT   rX   r[   __static_attributes__r   r   r   r   r      s.    :C ((	(((--r   r   )numpyr   numbar   
numba.corer   numba.core.errorsr   numba.tests.supportr   r   r   r   r   r   <module>rh      s)       ) (I-x I-r   