
    HR-eL                         d dl Z d dlZd dlmc mZ d dlmZ d dlmZ d dl	m
Z
mZ d dlmZmZ d Zd Z G d d          Zej                            d	e
j                  d
             ZdS )    N)	cosmology)
parametersrealizations)Planck13default_cosmologyc                      t          t                    } t          |           t          t          j                  k    sJ t          j        D ]}|| v sJ 	dS )zATest the realizations are in ``dir`` of :mod:`astropy.cosmology`.N)dirr   set__all__r   	availabledns     Ilib/python3.11/site-packages/astropy/cosmology/tests/test_realizations.py!test_realizations_in_toplevel_dirr      sZ    IAq66S*++++++!  Avvvvv     c                      t          t                    } t          |           t          t          j                  k    sJ t          j        D ]}|| v sJ 	dS )zNTest the realizations are in ``dir`` of :mod:`astropy.cosmology.realizations`.N)r	   r   r
   r   r   r   r   s     r   %test_realizations_in_realizations_dirr      s\    LAq66S-......!  Avvvvv r   c                       e Zd ZdZd Zd Zd Zd Zej	        
                    dej                  d             Zej	        
                    dej                  d             Zd	 Zd
S )Test_default_cosmologyzETests for :class:`~astropy.cosmology.realizations.default_cosmology`.c                 p    t          j                    }|t          j        t           j                  u sJ dS )zCTest :meth:`astropy.cosmology.default_cosmology.get` current value.N)r   getvalidate_valueselfcosmos     r   test_get_currentz'Test_default_cosmology.test_get_current)   s7    !%'')23D3KLLLLLLLLr   c                     t          j        d          }|J t          j        d          }|t          u sJ t          j        t
                    5  t          j        d          }ddd           dS # 1 swxY w Y   dS )z*Test method ``get_cosmology_from_string``.
no_defaultNr   fail!)r   get_cosmology_from_stringr   pytestraises
ValueError)r   recwarnr   s      r   test_get_cosmology_from_stringz5Test_default_cosmology.test_get_cosmology_from_string1   s    !;LII}}}!;JGG    ]:&& 	I 	I%?HHE	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	Is   A33A7:A7c                    t          j        t          d          5  t          j        t                     ddd           n# 1 swxY w Y   t          j        t
          d          5  t          j        d           ddd           n# 1 swxY w Y   t          j        t          d          5  t          j        d           ddd           dS # 1 swxY w Y   dS )z:Test :meth:`astropy.cosmology.default_cosmology.validate`.zmust be a string or Cosmology)matchNzUnknown cosmologyr!   zcannot find a Cosmologyr   )r#   r$   	TypeErrorr   r   r%   )r   s    r   test_validate_failz)Test_default_cosmology.test_validate_fail?   s    ]9,KLLL 	2 	2&y111	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 ]:-@AAA 	0 	0&w///	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 ]9,EFFF 	4 	4&{333	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4s5   AA	A(B		BB/CCCc                 N    t          j        d          }|t          j        u sJ dS )z-Test method ``validate`` for specific values.N)r   r   r   Planck18)r   values     r   test_validate_defaultz,Test_default_cosmology.test_validate_defaultM   s,    !*400-------r   namec                 `    t          j        |          }|t          t          |          u sJ dS )z*Test method ``validate`` for string input.N)r   r   getattrr   )r   r0   r.   s      r   test_validate_strz(Test_default_cosmology.test_validate_strR   s5     "*400d33333333r   c                 d    t          t          |          }t          j        |          }||u sJ dS )z6Test method ``validate`` for cosmology instance input.N)r2   r   r   r   )r   r0   r   r.   s       r   test_validate_cosmoz*Test_default_cosmology.test_validate_cosmoX   s4     d++!*511~~~~~~r   c                 6    t          j        d          }|J dS )z?Test :meth:`astropy.cosmology.default_cosmology.get` to `None`.r    N)r   r   r   s     r   test_validate_no_defaultz/Test_default_cosmology.test_validate_no_default_   s    !*<88}}}}}r   N)__name__
__module____qualname____doc__r   r'   r+   r/   r#   markparametrizer   r   r3   r5   r7    r   r   r   r   #   s        OO
M M M	I 	I 	I4 4 4. . .
 [VZ%9::4 4 ;:4
 [VZ%9::  ;:    r   r   r0   c                 v   t          t          |           }t          j        ||          }t	          j        t                    5  t          j        |          }ddd           n# 1 swxY w Y   ||k    sJ |j        |j        k    sJ t          j        |          }||k    sJ |j        |j        k    sJ dS )zd
    Test in-built realizations can pickle and unpickle.
    Also a regression test for #12008.
    )protocolN)	r2   r   pickledumpsuadd_enabled_unitsculoadsmeta)r0   pickle_protocoloriginalf	unpickleds        r    test_pickle_builtin_realizationsrL   e   s     y$''H 	X888A	
	R	 	  $ $LOO	$ $ $ $ $ $ $ $ $ $ $ $ $ $ $     >X]**** QI    >X]******s   A&&A*-A*)rA   r#   astropy.cosmology.unitsr   unitsrE   astropy.unitsrC   astropyastropy.cosmologyr   r   astropy.cosmology.realizationsr   r   r   r   r   r<   r=   r   rL   r>   r   r   <module>rS      s     % $ $ $ $ $ $ $ $             6 6 6 6 6 6 6 6 F F F F F F F F    ? ? ? ? ? ? ? ?D !566+ + 76+ + +r   