o
    沪g                     @  sJ   d dl mZ d dlmZ d dlmZ d dlmZ edddZd	d
 Z	dS )    )annotations)contextmanager)Any)configconfig_overridesdict[str, Any]c                 c  sR    ddl m} t| }|jtd|d dV  W d   dS 1 s"w   Y  dS )a  A context manager that overrides config options. It can
    also be used as a function decorator.

    Examples:
    >>> with patch_config_options({"server.headless": True}):
    ...     assert config.get_option("server.headless") is True
    ...     # Other test code that relies on these options

    >>> @patch_config_options({"server.headless": True})
    ... def test_my_thing():
    ...     assert config.get_option("server.headless") is True
    r   )patch
get_option)newN)unittest.mockr   build_mock_config_get_optionobjectr   )r   r   mock_get_option r   U/var/www/html/chatdoc2/venv/lib/python3.10/site-packages/streamlit/testing/v1/util.pypatch_config_options   s   "r   c                   s   t j  fdd}|S )Nc                   s   | v r|  S  | S )Nr   )nameorig_get_optionoverrides_dictr   r   mock_config_get_option0   s   z<build_mock_config_get_option.<locals>.mock_config_get_option)r   r	   )r   r   r   r   r   r   -   s   r   N)r   r   )

__future__r   
contextlibr   typingr   	streamlitr   r   r   r   r   r   r   <module>   s   