
    IR-eS                        d Z ddlZddlZddlZddlmZ ddlmZm	Z	m
Z
 ej                            dej        ej        dddg          d             Zej                            d	ej        ej        fd
ddd	g          d             Zd Zd Zd Zd Zd Zd Zej                            di dddg          d             ZdS )zG
Some might be indirectly tested already in ``astropy.io.fits.tests``.
    N)Table)diff_valuesreport_diff_valueswhere_not_allclosea(\?   c                 *    t          | |           rJ d S Nr   )r   s    =lib/python3.11/site-packages/astropy/utils/tests/test_diff.pytest_diff_values_falser      s    1a           r   b)r   g?)r	      )r	   r   c                 *    t          | |          sJ d S r   r   r   s     r   test_diff_values_truer      s      q!r   c                      t          j                    } t          j        d          }t          j        d          }t	          |||           }|rJ |                                 }d|v sJ d|v sJ dS )zP
    Regression test for https://github.com/spacetelescope/PyFITS/issues/21
    gA($w?gH$w?fileobjza>zb>N)ioStringIOnpfloat32r   getvaluefr   r   	identicalouts        r   test_float_comparisonr!      sz     	A

;A

;A"1a333I
**,,C 3;;;;3;;;;;;r   c                      t          j                    } d}d}t          |||           }|rJ |                                 }|dk    sJ dS )zL
    Regression test for https://github.com/astropy/astropy/issues/4122
          ?z1.0r   z7  (float) a> 1.0
    (str) b> '1.0'
           ? +   +
Nr   r   r   r   r   s        r   test_diff_typesr%   +   sl     	AAA"1a333I
**,,C	     r   c                      t          j                    } t          dd|           rJ |                                 }|dk    sJ dS )z2Test comparison of different numeric scalar types.r#   r	   r   z   (float) a> 1.0
    (int) b> 1
Nr$   )r   r    s     r   test_diff_numeric_scalar_typesr'   >   sM    
A!#q!444444
**,,C6666666r   c                      t          j                    } t          j        d                              dd          }|dz   }t          |||           }|rJ |                                 }|dk    sJ dS )z#
    Test diff-ing two arrays.
    	      r	   r   zy  at [0, 0]:
    a> 0
    b> 1
  at [0, 1]:
    a> 1
    b> 2
  at [0, 2]:
    a> 2
    b> 3
  ...and at 6 more indices.
N)r   r   r   arangereshaper   r   r   s        r   test_array_comparisonr-   F   s     	A
	!Q""A	AA"1a333I
**,,C 	( 		( 		( 		( 		( 		( 		(r   c                      t          j                    } t          j        d          }t	          ||d         |           }|rJ |                                 }|dk    sJ dS )z6
    Test diff-ing two differently shaped arrays.
    )r	   r   r*   r   r   zE  Different array shapes:
    a> (1, 2, 3)
     ?  ---
    b> (2, 3)
N)r   r   r   emptyr   r   )r   r   r   r    s       r   !test_diff_shaped_array_comparisonr0   ^   sy     	A
A"1adA666I
**,,CV	W 	W 	W 	W 	W 	Wr   c                     t          j        dd          } t          j        dd          }t          j                    }t	          | ||          }|rJ |                                }|dk    sJ t	          | | |          sJ dS )z1
    Test diff-ing two simple Table objects.
    zname    obs_date    mag_b  mag_v
M31     2012-01-02  17.0   16.0
M82     2012-10-29  16.2   15.2
M101    2012-10-31  15.1   15.5ascii)formatzname    obs_date    mag_b  mag_v
M31     2012-01-02  17.0   16.5
M82     2012-10-29  16.2   15.2
M101    2012-10-30  15.1   15.5
NEW     2018-05-08   nan    9.0r   at       name  obs_date  mag_b mag_v
     ---- ---------- ----- -----
  a>  M31 2012-01-02  17.0  16.0
   ?                           ^
  b>  M31 2012-01-02  17.0  16.5
   ?                           ^
      M82 2012-10-29  16.2  15.2
  a> M101 2012-10-31  15.1  15.5
   ?               ^
  b> M101 2012-10-30  15.1  15.5
   ?               ^
  b>  NEW 2018-05-08   nan   9.0
N)r   readr   r   r   r   )r   r   r   r   r    s        r   test_tablediffr5   m   s     	
	# 	 	 	A 	
	#
 	 	 	A 	A"1a333I
**,,C - 	- 	- 	- 	- aA........r   kwargs)atolrtolc                 0   t          j        dt           j        t           j        dg          }t          j        dt           j        t           j        dg          }t	          ||fi | dgfk    sJ t          t	          ||fi | d                   dk    sJ d S )Nr	   g      @gffffff@r*   r   )r   arraynaninfr   len)r6   r   r   s      r   test_where_not_allcloser>      s    
!RVRVS)**A
!RVRVS)**Aa--f--1#7777!!Q11&11!455::::::r   )__doc__r   numpyr   pytestastropy.tabler   astropy.utils.diffr   r   r   markparametrizer;   r<   r   r   r!   r%   r'   r-   r0   r5   r>    r   r   <module>rG      s    
			            R R R R R R R R R R rvrvtQ<==! ! >=! "&"&!;*M     "  &7 7 7  0  '/ '/ '/T BA(>(>#?@@; ; A@; ; ;r   