U
    e»{jÍ  ã                   @   sÄ   d dl mZ d dlZd dlZd dlmZmZmZm	Z	 d dl
mZ ddlmZmZmZ dd„ Zd	d
„ Zej ddefdefddddgeeeeffd dddgeeeeffg¡dd„ ƒZG dd„ dƒZdS )é    )ÚinfN)ÚaszarrÚinf_likeÚvectorize_if_neededÚvectorize_redshift_method)ÚAstropyDeprecationWarningé   )Ú_zarrÚ
invalid_zsÚvalid_zsc                  C   s(  G dd„ dƒ} | ƒ }t |jdƒs$t‚t|jjtjƒs8t‚| d¡dksJt‚t| d¡tƒs^t‚| t d¡¡t d¡ks|t‚t| t d¡¡tjƒs˜t‚t	| t 
ddg¡¡t 
ddg¡kƒsÂt‚t| t 
ddg¡¡tjƒsât‚t	| ddg¡t 
ddg¡kƒ�st‚t| ddg¡tjƒ�s$t‚dS )z?Test :func:`astropy.cosmology.utils.vectorize_redshift_method`.c                   @   s   e Zd Zedd„ ƒZdS )z-test_vectorize_redshift_method.<locals>.Classc                 S   s   |S )N© )ÚselfÚzr   r   úa/var/www/html/bwave/python/venv/lib/python3.8/site-packages/astropy/cosmology/tests/test_utils.pyÚmethod   s    z4test_vectorize_redshift_method.<locals>.Class.methodN)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r   ÚClass   s   r   Ú__vectorized__r   é   N)Úhasattrr   ÚAssertionErrorÚ
isinstancer   ÚnpZ	vectorizeÚintÚfloat64ÚallÚarrayZndarray)r   Úcr   r   r   Útest_vectorize_redshift_method   s    * &r    c               	   C   sR   dd„ } t  t¡�6 t| dƒdks&t‚tt| ddgƒddgkƒsDt‚W 5 Q R X dS )zÍ
    Test :func:`astropy.cosmology.utils.vectorize_if_needed`.
    There's no need to test 'veckw' because that is directly pasased to
    `numpy.vectorize` which thoroughly tests the various inputs.

    c                 S   s   | d S )Nr   r   )Úxr   r   r   Úfunc9   s    z&test_vectorize_if_needed.<locals>.funcr   é   é   é	   N)ÚpytestÚwarnsr   r   r   r   )r"   r   r   r   Útest_vectorize_if_needed1   s    r(   zarr, expectedg        g      ð?ç       @ç      @r   r$   c              	   C   s0   t  t¡� t t| ƒ|k¡s"t‚W 5 Q R X dS )zÒ
    Test :func:`astropy.cosmology.utils.inf_like`.
    All inputs should give a float output.
    These tests are also in the docstring, but it's better to have them also
    in one consolidated location.
    N)r&   r'   r   r   r   r   r   )ZarrÚexpectedr   r   r   Útest_inf_likeC   s    r,   c                   @   s\   e Zd Zej deeeddde	 
d¡ddeeeeg
ƒƒ¡dd	„ ƒZej d
e¡dd„ ƒZdS )ÚTest_aszarrz	z, expectr   r   iL  iä  r)   r*   c                 C   s   t |ƒ}t ||¡st‚dS ©z,Test :func:`astropy.cosmology.utils.aszarr`.N)r   r   Zarray_equalr   )r   r   ÚexpectÚgotr   r   r   Ú
test_valid[   s    zTest_aszarr.test_validzz, excc              	   C   s"   t  |¡� t|ƒ W 5 Q R X dS r.   )r&   Zraisesr   )r   r   Úexcr   r   r   Útest_invalidi   s    zTest_aszarr.test_invalidN)r   r   r   r&   ÚmarkÚparametrizeÚlistÚzipr   r   r   r	   r1   r
   r3   r   r   r   r   r-   Z   s   þÿþ	
r-   )Úmathr   Únumpyr   r&   Zastropy.cosmology.utilsr   r   r   r   Zastropy.utils.exceptionsr   Z	test_corer	   r
   r   r    r(   r4   r5   r,   r-   r   r   r   r   Ú<module>   s"   üþ	
