U
    e»{j	  ã                   @   sN   d dl Z d dlmZmZ ddlmZmZ G dd„ deƒZG dd„ deeƒZdS )	é    N)Úfrom_cosmologyÚto_cosmologyé   )ÚIODirectTestBaseÚToFromTestMixinBasec                   @   sF   e Zd ZdZdd„ Zdd„ Zdd„ Zej 	dd	d
ddg¡dd„ ƒZ
dS )ÚToFromCosmologyTestMixinaª  
    Tests for a Cosmology[To/From]Format with ``format="astropy.cosmology"``.
    This class will not be directly called by :mod:`pytest` since its name does
    not begin with ``Test``. To activate the contained tests this class must
    be inherited in a subclass. Subclasses must define a :func:`pytest.fixture`
    ``cosmo`` that returns/yields an instance of a |Cosmology|.
    See ``TestCosmology`` for an example.
    c                 C   s   |dƒ}||kst ‚dS )úTest cosmology -> cosmology.úastropy.cosmologyN©ÚAssertionError)ÚselfÚcosmoÚ	to_formatÚnewcosmo© r   úh/var/www/html/bwave/python/venv/lib/python3.8/site-packages/astropy/cosmology/io/tests/test_cosmology.pyÚtest_to_cosmology_default   s    z2ToFromCosmologyTestMixin.test_to_cosmology_defaultc              	   C   s&   t  t¡� |ddd� W 5 Q R X dS )z%Test incorrect type in ``Cosmology``.zNOT A COSMOLOGYr	   ©ÚformatN)ÚpytestZraisesÚ	TypeError)r   r   Úfrom_formatr   r   r   Útest_from_not_cosmology   s    z0ToFromCosmologyTestMixin.test_from_not_cosmologyc                 C   s   ||ƒ}||kst ‚dS )r   Nr
   )r   r   r   r   r   r   r   Útest_from_cosmology_default"   s    z4ToFromCosmologyTestMixin.test_from_cosmology_defaultr   TFNr	   c                 C   s2   |dƒ}||kst ‚|j||d�}|dks.t ‚dS )a`  Test :meth:`astropy.cosmology.Cosmology.is_equivalent`.

        This test checks that Cosmology equivalency can be extended to any
        Python object that can be converted to a Cosmology -- in this case
        a Cosmology! Since it's the identity conversion, the cosmology is
        always equivalent to itself, regardless of ``format``.
        r	   r   TN)r   Zis_equivalent)r   r   r   r   ÚobjZis_equivr   r   r   Útest_is_equivalent_to_cosmology'   s    	z8ToFromCosmologyTestMixin.test_is_equivalent_to_cosmology)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   ÚmarkZparametrizer   r   r   r   r   r      s   	r   c                   @   s   e Zd ZdZdd„ ZdS )ÚTestToFromCosmologyz$Directly test ``to/from_cosmology``.c                 C   s   t tdœ| _d S )N)ÚtoÚfrom)r   r   Z	functions)r   r   r   r   Úsetup_class:   s    zTestToFromCosmology.setup_classN)r   r   r   r   r$   r   r   r   r   r!   7   s   r!   )	r   Zastropy.cosmology.io.cosmologyr   r   Úbaser   r   r   r!   r   r   r   r   Ú<module>   s   )