
    HR-e	                     h    d dl Z d dlmZmZ ddlmZmZ  G d de          Z G d dee          ZdS )	    N)from_cosmologyto_cosmology   )IODirectTestBaseToFromTestMixinBasec                   p    e Zd ZdZd Zd Zd Zej        	                    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                 (     |d          }||u sJ dS )Test cosmology -> cosmology.astropy.cosmologyN )selfcosmo	to_formatnewcosmos       Ilib/python3.11/site-packages/astropy/cosmology/io/tests/test_cosmology.pytest_to_cosmology_defaultz2ToFromCosmologyTestMixin.test_to_cosmology_default   s)    90115          c                     t          j        t                    5   |dd           ddd           dS # 1 swxY w Y   dS )z%Test incorrect type in ``Cosmology``.zNOT A COSMOLOGYr   formatN)pytestraises	TypeError)r   r   from_formats      r   test_from_not_cosmologyz0ToFromCosmologyTestMixin.test_from_not_cosmology   s    ]9%% 	G 	GK)2EFFFF	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	Gs   599c                 (     ||          }||u sJ dS )r   Nr   )r   r   r   r   s       r   test_from_cosmology_defaultz4ToFromCosmologyTestMixin.test_from_cosmology_default"   s(    ;u%%5      r   r   )TFNr   c                 b     |d          }||u sJ |                     ||          }|du sJ 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)is_equivalent)r   r   r   r   objis_equivs         r   test_is_equivalent_to_cosmologyz8ToFromCosmologyTestMixin.test_is_equivalent_to_cosmology'   sP     i+,,e||||&&s6&::4r   N)__name__
__module____qualname____doc__r   r   r   r   markparametrizer#   r   r   r   r	   r	      s         ! ! !
G G G
! ! !
 [X'O'O'OPP    QP     r   r	   c                       e Zd ZdZd ZdS )TestToFromCosmologyz$Directly test ``to/from_cosmology``.c                 .    t           t          d| _        d S )N)tofrom)r   r   	functions)r   s    r   setup_classzTestToFromCosmology.setup_class:   s     ,nEEr   N)r$   r%   r&   r'   r0   r   r   r   r+   r+   7   s.        ..F F F F Fr   r+   )	r   astropy.cosmology.io.cosmologyr   r   baser   r   r	   r+   r   r   r   <module>r3      s     H G G G G G G G 7 7 7 7 7 7 7 7
&  &  &  &  & 2 &  &  & RF F F F F*,D F F F F Fr   