U
    »mœdÜ  ã                   @   sL   d Z ddlZddlZddlmZ ejjeejdƒ dd�Z	G dd„ dƒZ
dS )	z"
Check the SciPy config is valid.
é    N)ÚpatchZ_built_with_mesonzRequires Meson builds)Úreasonc                   @   s>   e Zd ZdddgZedƒdd„ ƒZdd„ Zd	d
„ Zdd„ ZdS )ÚTestSciPyConfigsZ	CompilerszMachine InformationzPython Informationzscipy.__config__._check_pyyamlc              	   C   s*   t ƒ |_t t¡� t ¡  W 5 Q R X d S )N)ÚModuleNotFoundErrorZside_effectÚpytestZwarnsÚUserWarningÚscipyÚshow_config)ÚselfZmock_yaml_importer© r   úU/home/sam/Atlas/atlas_env/lib/python3.8/site-packages/scipy/misc/tests/test_config.pyÚtest_pyyaml_not_found   s    z&TestSciPyConfigs.test_pyyaml_not_foundc                    s>   t jdd�‰ tˆ tƒst‚t‡ fdd„| jD ƒƒs:tdƒ‚d S )NZdicts©Úmodec                    s   g | ]}|ˆ k‘qS r   r   )Ú.0Úkey©Úconfigr   r   Ú
<listcomp>   s     z3TestSciPyConfigs.test_dict_mode.<locals>.<listcomp>zFRequired key missing, see index of `False` with `REQUIRED_CONFIG_KEYS`)r   r	   Ú
isinstanceÚdictÚAssertionErrorÚallÚREQUIRED_CONFIG_KEYS©r
   r   r   r   Útest_dict_mode   s
    ÿzTestSciPyConfigs.test_dict_modec              	   C   s&   t  t¡� tjdd� W 5 Q R X d S )NZfoor   )r   ZraisesÚAttributeErrorr   r	   r   r   r   r   Útest_invalid_mode$   s    z"TestSciPyConfigs.test_invalid_modec                 C   s   t tjjƒdkstdƒ‚d S )Né   zGNew mode detected, please add UT if applicable and increment this count)Úlenr   Ú
__config__ZDisplayModesr   r   r   r   r   Útest_warn_to_add_tests(   s    ÿz'TestSciPyConfigs.test_warn_to_add_testsN)	Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r!   r   r   r   r   r      s   ý
	r   )Ú__doc__r   r   Zunittest.mockr   ÚmarkZskipifÚhasattrr    Z
pytestmarkr   r   r   r   r   Ú<module>   s   þ