
    g                    "   d dl mZ d dlZd dlZd dlZd dlZd dlZd dlmZ d dl	m
Z
mZmZ d dlmZ d dlmZ d dlmZ d dlmZ d d	lmZ d d
lmZ d dlmZ d dlmZ d dlmZ d dlm Z  d dl!m"Z" d dl#m$Z$ d dl%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z<m=Z=m>Z>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJmKZKmLZLmMZMmNZNmOZOmPZPmQZQmRZRmSZS d dlTmUZU d dlVmWZW d dlXmYZYmZZZ e
rd dl[m\Z\ d dl]m^Z^  ej                         Z` G d d      Zay)    )annotationsN)Path)TYPE_CHECKINGAnyCallable)	MagicMock)parse)source_util)Runtime)MemoryCacheStorageManager)MediaFileManager)MemoryMediaFileStorage)PagesManager)Secrets)TESTING_KEY)SafeSessionState)SessionState).BlockButtonButtonGroupCaption	ChatInputChatMessageCheckboxCodeColorPickerColumn	Dataframe	DateInputDividerElementListElementTreeError	ExceptionExpanderHeaderInfoJsonLatexMarkdownMetricMultiselectNodeNumberInputRadio	SelectboxSelectSliderSliderStatus	SubheaderSuccessTabTableTextTextArea	TextInput	TimeInputTitleToastToggleWarning
WidgetListrepr_)LocalScriptRunner)patch_config_options)HASHLIB_KWARGScalc_md5)Sequence)WidgetStatesc                     e Zd ZdZddd	 	 	 d?dZeddd@d       Zedddd	 	 	 	 	 d@d	       Zedddd	 	 	 	 	 dAd
       Zedd	 	 	 	 	 dBd       Z		 	 dC	 	 	 	 	 dDdZ
dddEdZdFdZedGd       ZedGd       ZedHd       ZedId       ZedJd       ZedKd       ZedLd       ZedMd       ZedNd       ZedOd       ZedPd       ZedQd       ZedRd       ZedSd       ZedTd       ZedUd       ZedVd        ZedWd!       ZedXd"       Z edYd#       Z!edZd$       Z"ed[d%       Z#ed\d&       Z$ed]d'       Z%ed^d(       Z&ed_d)       Z'ed`d*       Z(edad+       Z)edbd,       Z*edcd-       Z+eddd.       Z,eded/       Z-edfd0       Z.edgd1       Z/edhd2       Z0edid3       Z1edjd4       Z2edkd5       Z3edld6       Z4edmd7       Z5ednd8       Z6edod9       Z7dpd:Z8d; Z9dqd<Z:drd=Z;dsd>Z<y)tAppTesta
  
    A simulated Streamlit app to check the correctness of displayed    elements and outputs.

    An instance of ``AppTest`` simulates a running Streamlit app. This class
    provides methods to set up, manipulate, and inspect the app contents via
    API instead of a browser UI. It can be used to write automated tests of an
    app in various scenarios. These can then be run using a tool like pytest.

    ``AppTest`` can be initialized by one of three class methods:

    * |st.testing.v1.AppTest.from_file|_ (recommended)
    * |st.testing.v1.AppTest.from_string|_
    * |st.testing.v1.AppTest.from_function|_

    Once initialized, Session State and widget values can be updated and the
    script can be run. Unlike an actual live-running Streamlit app, you need to
    call ``AppTest.run()`` explicitly to re-run the app after changing a widget
    value. Switching pages also requires an explicit, follow-up call to
    ``AppTest.run()``.

    ``AppTest`` enables developers to build tests on their app as-is, in the
    familiar python test format, without major refactoring or abstracting out
    logic to be tested separately from the UI. Tests can run quickly with very
    low overhead. A typical pattern is to build a suite of tests for an app
    that ensure consistent functionality as the app evolves, and run the tests
    locally and/or in a CI environment like Github Actions.

    .. note::
        ``AppTest`` only supports testing a single page of an app per
        instance. For multipage apps, each page will need to be tested
        separately. ``AppTest`` is not yet compatible with multipage apps
        using ``st.navigation`` and ``st.Page``.

    .. |st.testing.v1.AppTest.from_file| replace:: ``st.testing.v1.AppTest.from_file``
    .. _st.testing.v1.AppTest.from_file: #apptestfrom_file
    .. |st.testing.v1.AppTest.from_string| replace:: ``st.testing.v1.AppTest.from_string``
    .. _st.testing.v1.AppTest.from_string: #apptestfrom_string
    .. |st.testing.v1.AppTest.from_function| replace:: ``st.testing.v1.AppTest.from_function``
    .. _st.testing.v1.AppTest.from_function: #apptestfrom_function

    Attributes
    ----------
    secrets: dict[str, Any]
        Dictionary of secrets to be used the simulated app. Use dict-like
        syntax to set secret values for the simulated app.

    session_state: SafeSessionState
        Session State for the simulated app. SafeSessionState object supports
        read and write operations as usual for Streamlit apps.

    query_params: dict[str, Any]
        Dictionary of query parameters to be used by the simluated app. Use
        dict-like syntax to set ``query_params`` values for the simulated app.
    Nargskwargsc                   t        |      | _        || _        t               }i |t        <   t        |d       | _        i | _        i | _        || _	        || _
        d| _        t               }| |_        || _        y )Nc                      y N rP       R/var/www/openai/venv/lib/python3.12/site-packages/streamlit/testing/v1/app_test.py<lambda>z"AppTest.__init__.<locals>.<lambda>   s    TrQ    )str_script_pathdefault_timeoutr   r   r   session_statequery_paramssecretsrK   rL   
_page_hashr"   _runner_tree)selfscript_pathrW   rK   rL   rX   trees          rR   __init__zAppTest.__init__   sr      ,.$%'k"-m\J,.')	}
rQ      rW   c               (    | j                  ||      S )a3  
        Create an instance of ``AppTest`` to simulate an app page defined        within a string.

        This is useful for testing short scripts that fit comfortably as an
        inline string in the test itself, without having to create a separate
        file for it. The script must be executable on its own and so must
        contain all necessary imports.

        Parameters
        ----------
        script: str
            The string contents of the script to be run.

        default_timeout: float
            Default time in seconds before a script run is timed out. Can be
            overridden for individual ``.run()`` calls.

        Returns
        -------
        AppTest
            A simulated Streamlit app for testing. The simulated app can be
            executed via ``.run()``.

        rc   )_from_string)clsscriptrW   s      rR   from_stringzAppTest.from_string   s    6 HHrQ   rW   rK   rL   c                  t        j                  t        |d      fi t        }|j	                         }t        t        j                  |      }t        j                  |      }|j                  |       t        t        |      |||      S )Nzutf-8ri   )hashlibmd5bytesrD   	hexdigestr   TMP_DIRnametextwrapdedent
write_textrI   rU   )	rf   rg   rW   rK   rL   hasherscript_namepathaligned_scripts	            rR   re   zAppTest._from_string   sp     U673F~F&&(GLL+.!0'IT&
 	
rQ   c                   t        j                  |      \  }}t        j                  dj	                  |            }|d|j
                   dz   }| j                  ||||      S )a  
        Create an instance of ``AppTest`` to simulate an app page defined        within a function.

        This is similar to ``AppTest.from_string()``, but more convenient to
        write with IDE assistance. The script must be executable on its own and
        so must contain all necessary imports.

        Parameters
        ----------
        script: Callable
            A function whose body will be used as a script. Must be runnable
            in isolation, so it must include any necessary imports.

        default_timeout: float
            Default time in seconds before a script run is timed out. Can be
            overridden for individual ``.run()`` calls.

        args: tuple
            An optional tuple of args to pass to the script function.

        kwargs: dict
            An optional dict of kwargs to pass to the script function.

        Returns
        -------
        AppTest
            A simulated Streamlit app for testing. The simulated app can be
            executed via ``.run()``.

        rT   
z(*__args, **__kwargs)ri   )inspectgetsourcelinesrq   rr   join__name__re   )	rf   rg   rW   rK   rL   source_lines_sourcemodules	            rR   from_functionzAppTest.from_function   sj    P "008a!67Bv//DEEO$v   
 	
rQ   c               
   t        |      }|j                         r|}nYt        j                  j	                  t        j
                  d            }t        |d   j                        }|j                  |z  }t        ||      S )a.  
        Create an instance of ``AppTest`` to simulate an app page defined        within a file.

        This option is most convenient for CI workflows and testing of
        published apps. The script must be executable on its own and so must
        contain all necessary imports.

        Parameters
        ----------
        script_path: str | Path
            Path to a script file. The path should be absolute or relative to
            the file calling ``.from_file``.

        default_timeout: float
            Default time in seconds before a script run is timed out. Can be
            overridden for individual ``.run()`` calls.

        Returns
        -------
        AppTest
            A simulated Streamlit app for testing. The simulated app can be
            executed via ``.run()``.
        N   rc   )	r   is_file	tracebackStackSummaryextract
walk_stackfilenameparentrI   )rf   r_   rW   rv   stackfilepaths         rR   	from_filezAppTest.from_file  sq    8 ;' D
 **2293G3G3MNEE!H--.H??[0Dt_==rQ   c                   ddl }|| j                  }t        t              }t	        t        d            |_        t               |_        |t        _	        t        | j                  d      }t        j                  5  t        j                  }dt        _        ddd       |j                  }| j                  r"t!               }| j                  |_        ||_        t%        | j                  | j&                  || j(                  | j*                        }	t-        dd	i      5  |	j/                  || j0                  || j2                        | _        | | j4                  _        ddd       |	j8                  d
   d   j:                  }
t=        j>                  |
      | _        t        j                  5  t        _        ddd       | j                  rA|j                  j"                  $tA        |j                  j"                        | _        ||_        dt        _	        | S # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   |xY w)zRun the script, and parse the output messages for querying
        and interaction.

        Timeout is in seconds, or None to use the default timeout of the runner.
        r   N)specz/mock/mediaF)setup_watcherrJ   zglobal.appTestTclient_state)!	streamlitrW   r   r   r   r   media_file_mgrr   cache_storage_manager	_instancer   rV   r
   _pages_cache_lock_cached_pagesrZ   r   _secretsrB   rX   rK   rL   rC   runrY   r[   r]   r\   
event_dataquery_stringr	   parse_qsdict)r^   widget_statetimeoutstmock_runtimepages_managersaved_cached_pagessaved_secretsnew_secretsscript_runnerr   s              rR   _runzAppTest._run4  s    	?**G !g.&6"=1'
# .G-H*($T%6%6eL**!,!:!:(,K% + "$<<!)K#'<<K $BJ);;
 "#3T":;&**d//$//DJ "&DJJ	 < %//3NCPP!NN<8 **(:K% + <<zz"".#BJJ$7$78&BJ K +*$ <; +*s$   =H ?H(-H4H%(H14H=r   c               :    | j                   j                  |      S )a  Run the script from the current state.

        This is equivalent to manually rerunning the app or the rerun that
        occurs upon user interaction. ``AppTest.run()`` must be manually called
        after updating a widget value or switching pages as script reruns do
        not occur automatically as they do for live-running Streamlit apps.

        Parameters
        ----------
        timeout : float or None
            The maximum number of seconds to run the script. If ``timeout`` is
            ``None`` (default), Streamlit uses the default timeout set for the
            instance of ``AppTest``.

        Returns
        -------
        AppTest
            self

        r   )r]   r   )r^   r   s     rR   r   zAppTest.runt  s    * zz~~g~..rQ   c                    t        | j                        j                  }||z  }|j                         st	        d| d      t        |j                               }t        |      | _        | S )a  Switch to another page of the app.

        This method does not automatically rerun the app. Use a follow-up call
        to ``AppTest.run()`` to obtain the elements on the selected page.

        Parameters
        ----------
        page_path: str
            Path of the page to switch to. The path must be relative to the
            main script's location (e.g. ``"pages/my_page.py"``).

        Returns
        -------
        AppTest
            self

        zUnable to find script at z:, make sure the page given is relative to the main script.)	r   rV   r   r   
ValueErrorrU   resolverE   r[   )r^   	page_pathmain_dirfull_page_pathpage_path_strs        rR   switch_pagezAppTest.switch_page  sp    $ ))*11!I-%%'+I;6pq  N2245"=1rQ   c                .    | j                   j                  S )aP  Sequence of elements within the main body of the app.

        Returns
        -------
        Block
            A container of elements. Block can be queried for elements in the
            same manner as ``AppTest``. For example, ``Block.checkbox`` will
            return all ``st.checkbox`` within the associated container.
        )r]   mainr^   s    rR   r   zAppTest.main  s     zzrQ   c                .    | j                   j                  S )aJ  Sequence of all elements within ``st.sidebar``.

        Returns
        -------
        Block
            A container of elements. Block can be queried for elements in the
            same manner as ``AppTest``. For example, ``Block.checkbox`` will
            return all ``st.checkbox`` within the associated container.
        )r]   sidebarr   s    rR   r   zAppTest.sidebar  s     zz!!!rQ   c                .    | j                   j                  S )a  Sequence of all ``st.button`` and ``st.form_submit_button`` widgets.

        Returns
        -------
        WidgetList of Button
            Sequence of all ``st.button`` and ``st.form_submit_button``
            widgets. Individual widgets can be accessed from a WidgetList by
            index (order on the page) or key. For example, ``at.button[0]`` for
            the first widget or ``at.button(key="my_key")`` for a widget with a
            given key.
        )r]   buttonr   s    rR   r   zAppTest.button  s     zz   rQ   c                .    | j                   j                  S )a  Sequence of all ``st.feedback`` widgets.

        Returns
        -------
        WidgetList of ButtonGroup
            Sequence of all ``st.feedback`` widgets. Individual widgets can be
            accessed from a WidgetList by index (order on the page) or key. For
            example, ``at.button_group[0]`` for the first widget or
            ``at.button_group(key="my_key")`` for a widget with a given key.
        )r]   button_groupr   s    rR   r   zAppTest.button_group       zz&&&rQ   c                .    | j                   j                  S )a  Sequence of all ``st.caption`` elements.

        Returns
        -------
        ElementList of Caption
            Sequence of all ``st.caption`` elements. Individual elements can be
            accessed from an ElementList by index (order on the page). For
            example, ``at.caption[0]`` for the first element. Caption is an
            extension of the Element class.
        )r]   captionr   s    rR   r   zAppTest.caption       zz!!!rQ   c                .    | j                   j                  S )a  Sequence of all ``st.chat_input`` widgets.

        Returns
        -------
        WidgetList of ChatInput
            Sequence of all ``st.chat_input`` widgets. Individual widgets can
            be accessed from a WidgetList by index (order on the page) or key.
            For example, ``at.chat_input[0]`` for the first widget or
            ``at.chat_input(key="my_key")`` for a widget with a given key.
        )r]   
chat_inputr   s    rR   r   zAppTest.chat_input       zz$$$rQ   c                .    | j                   j                  S )a  Sequence of all ``st.chat_message`` elements.

        Returns
        -------
        Sequence of ChatMessage
            Sequence of all ``st.chat_message`` elements. Individual elements can be
            accessed from an ElementList by index (order on the page). For
            example, ``at.chat_message[0]`` for the first element.  ChatMessage
            is an extension of the Block class.
        )r]   chat_messager   s    rR   r   zAppTest.chat_message  r   rQ   c                .    | j                   j                  S )a  Sequence of all ``st.checkbox`` widgets.

        Returns
        -------
        WidgetList of Checkbox
            Sequence of all ``st.checkbox`` widgets. Individual widgets can
            be accessed from a WidgetList by index (order on the page) or key.
            For example, ``at.checkbox[0]`` for the first widget or
            ``at.checkbox(key="my_key")`` for a widget with a given key.
        )r]   checkboxr   s    rR   r   zAppTest.checkbox       zz"""rQ   c                .    | j                   j                  S )au  Sequence of all ``st.code`` elements.

        Returns
        -------
        ElementList of Code
            Sequence of all ``st.code`` elements. Individual elements can be
            accessed from an ElementList by index (order on the page). For
            example, ``at.code[0]`` for the first element. Code is an
            extension of the Element class.
        )r]   coder   s    rR   r   zAppTest.code       zzrQ   c                .    | j                   j                  S )a  Sequence of all ``st.color_picker`` widgets.

        Returns
        -------
        WidgetList of ColorPicker
            Sequence of all ``st.color_picker`` widgets. Individual widgets can
            be accessed from a WidgetList by index (order on the page) or key.
            For example, ``at.color_picker[0]`` for the first widget or
            ``at.color_picker(key="my_key")`` for a widget with a given key.
        )r]   color_pickerr   s    rR   r   zAppTest.color_picker$  r   rQ   c                .    | j                   j                  S )a  Sequence of all columns within ``st.columns`` elements.

        Each column within a single ``st.columns`` will be returned as a
        separate Column in the Sequence.

        Returns
        -------
        Sequence of Column
            Sequence of all columns within ``st.columns`` elements. Individual
            columns can be accessed from an ElementList by index (order on the
            page). For example, ``at.columns[0]`` for the first column. Column
            is an extension of the Block class.
        )r]   columnsr   s    rR   r   zAppTest.columns2  s     zz!!!rQ   c                .    | j                   j                  S )a  Sequence of all ``st.dataframe`` elements.

        Returns
        -------
        ElementList of Dataframe
            Sequence of all ``st.dataframe`` elements. Individual elements can be
            accessed from an ElementList by index (order on the page). For
            example, ``at.dataframe[0]`` for the first element. Dataframe is an
            extension of the Element class.
        )r]   	dataframer   s    rR   r   zAppTest.dataframeC       zz###rQ   c                .    | j                   j                  S )a  Sequence of all ``st.date_input`` widgets.

        Returns
        -------
        WidgetList of DateInput
            Sequence of all ``st.date_input`` widgets. Individual widgets can
            be accessed from a WidgetList by index (order on the page) or key.
            For example, ``at.date_input[0]`` for the first widget or
            ``at.date_input(key="my_key")`` for a widget with a given key.
        )r]   
date_inputr   s    rR   r   zAppTest.date_inputQ  r   rQ   c                .    | j                   j                  S )a  Sequence of all ``st.divider`` elements.

        Returns
        -------
        ElementList of Divider
            Sequence of all ``st.divider`` elements. Individual elements can be
            accessed from an ElementList by index (order on the page). For
            example, ``at.divider[0]`` for the first element. Divider is an
            extension of the Element class.
        )r]   dividerr   s    rR   r   zAppTest.divider_  r   rQ   c                .    | j                   j                  S )az  Sequence of all ``st.error`` elements.

        Returns
        -------
        ElementList of Error
            Sequence of all ``st.error`` elements. Individual elements can be
            accessed from an ElementList by index (order on the page). For
            example, ``at.error[0]`` for the first element. Error is an
            extension of the Element class.
        )r]   errorr   s    rR   r   zAppTest.errorm       zzrQ   c                .    | j                   j                  S )a  Sequence of all ``st.exception`` elements.

        Returns
        -------
        ElementList of Exception
            Sequence of all ``st.exception`` elements. Individual elements can be
            accessed from an ElementList by index (order on the page). For
            example, ``at.exception[0]`` for the first element. Exception is an
            extension of the Element class.
        )r]   	exceptionr   s    rR   r   zAppTest.exception{  r   rQ   c                .    | j                   j                  S )a  Sequence of all ``st.expander`` elements.

        Returns
        -------
        Sequence of Expandable
            Sequence of all ``st.expander`` elements. Individual elements can be
            accessed from a Sequence by index (order on the page). For
            example, ``at.expander[0]`` for the first element. Expandable is an
            extension of the Block class.
        )r]   expanderr   s    rR   r   zAppTest.expander  r   rQ   c                .    | j                   j                  S )a  Sequence of all ``st.header`` elements.

        Returns
        -------
        ElementList of Header
            Sequence of all ``st.header`` elements. Individual elements can be
            accessed from an ElementList by index (order on the page). For
            example, ``at.header[0]`` for the first element. Header is an
            extension of the Element class.
        )r]   headerr   s    rR   r   zAppTest.header       zz   rQ   c                .    | j                   j                  S )au  Sequence of all ``st.info`` elements.

        Returns
        -------
        ElementList of Info
            Sequence of all ``st.info`` elements. Individual elements can be
            accessed from an ElementList by index (order on the page). For
            example, ``at.info[0]`` for the first element. Info is an
            extension of the Element class.
        )r]   infor   s    rR   r   zAppTest.info  r   rQ   c                .    | j                   j                  S )au  Sequence of all ``st.json`` elements.

        Returns
        -------
        ElementList of Json
            Sequence of all ``st.json`` elements. Individual elements can be
            accessed from an ElementList by index (order on the page). For
            example, ``at.json[0]`` for the first element. Json is an
            extension of the Element class.
        )r]   jsonr   s    rR   r   zAppTest.json  r   rQ   c                .    | j                   j                  S )az  Sequence of all ``st.latex`` elements.

        Returns
        -------
        ElementList of Latex
            Sequence of all ``st.latex`` elements. Individual elements can be
            accessed from an ElementList by index (order on the page). For
            example, ``at.latex[0]`` for the first element. Latex is an
            extension of the Element class.
        )r]   latexr   s    rR   r   zAppTest.latex  r   rQ   c                .    | j                   j                  S )a  Sequence of all ``st.markdown`` elements.

        Returns
        -------
        ElementList of Markdown
            Sequence of all ``st.markdown`` elements. Individual elements can be
            accessed from an ElementList by index (order on the page). For
            example, ``at.markdown[0]`` for the first element. Markdown is an
            extension of the Element class.
        )r]   markdownr   s    rR   r   zAppTest.markdown  r   rQ   c                .    | j                   j                  S )a  Sequence of all ``st.metric`` elements.

        Returns
        -------
        ElementList of Metric
            Sequence of all ``st.metric`` elements. Individual elements can be
            accessed from an ElementList by index (order on the page). For
            example, ``at.metric[0]`` for the first element. Metric is an
            extension of the Element class.
        )r]   metricr   s    rR   r   zAppTest.metric  r   rQ   c                .    | j                   j                  S )a  Sequence of all ``st.multiselect`` widgets.

        Returns
        -------
        WidgetList of Multiselect
            Sequence of all ``st.multiselect`` widgets. Individual widgets can
            be accessed from a WidgetList by index (order on the page) or key.
            For example, ``at.multiselect[0]`` for the first widget or
            ``at.multiselect(key="my_key")`` for a widget with a given key.
        )r]   multiselectr   s    rR   r   zAppTest.multiselect  s     zz%%%rQ   c                .    | j                   j                  S )a  Sequence of all ``st.number_input`` widgets.

        Returns
        -------
        WidgetList of NumberInput
            Sequence of all ``st.number_input`` widgets. Individual widgets can
            be accessed from a WidgetList by index (order on the page) or key.
            For example, ``at.number_input[0]`` for the first widget or
            ``at.number_input(key="my_key")`` for a widget with a given key.
        )r]   number_inputr   s    rR   r   zAppTest.number_input  r   rQ   c                .    | j                   j                  S )a  Sequence of all ``st.radio`` widgets.

        Returns
        -------
        WidgetList of Radio
            Sequence of all ``st.radio`` widgets. Individual widgets can
            be accessed from a WidgetList by index (order on the page) or key.
            For example, ``at.radio[0]`` for the first widget or
            ``at.radio(key="my_key")`` for a widget with a given key.
        )r]   radior   s    rR   r   zAppTest.radio  r   rQ   c                .    | j                   j                  S )a  Sequence of all ``st.select_slider`` widgets.

        Returns
        -------
        WidgetList of SelectSlider
            Sequence of all ``st.select_slider`` widgets. Individual widgets can
            be accessed from a WidgetList by index (order on the page) or key.
            For example, ``at.select_slider[0]`` for the first widget or
            ``at.select_slider(key="my_key")`` for a widget with a given key.
        )r]   select_sliderr   s    rR   r   zAppTest.select_slider  s     zz'''rQ   c                .    | j                   j                  S )a  Sequence of all ``st.selectbox`` widgets.

        Returns
        -------
        WidgetList of Selectbox
            Sequence of all ``st.selectbox`` widgets. Individual widgets can
            be accessed from a WidgetList by index (order on the page) or key.
            For example, ``at.selectbox[0]`` for the first widget or
            ``at.selectbox(key="my_key")`` for a widget with a given key.
        )r]   	selectboxr   s    rR   r   zAppTest.selectbox#  r   rQ   c                .    | j                   j                  S )a  Sequence of all ``st.slider`` widgets.

        Returns
        -------
        WidgetList of Slider
            Sequence of all ``st.slider`` widgets. Individual widgets can
            be accessed from a WidgetList by index (order on the page) or key.
            For example, ``at.slider[0]`` for the first widget or
            ``at.slider(key="my_key")`` for a widget with a given key.
        )r]   sliderr   s    rR   r   zAppTest.slider1  r   rQ   c                .    | j                   j                  S )a  Sequence of all ``st.subheader`` elements.

        Returns
        -------
        ElementList of Subheader
            Sequence of all ``st.subheader`` elements. Individual elements can be
            accessed from an ElementList by index (order on the page). For
            example, ``at.subheader[0]`` for the first element. Subheader is an
            extension of the Element class.
        )r]   	subheaderr   s    rR   r   zAppTest.subheader?  r   rQ   c                .    | j                   j                  S )a  Sequence of all ``st.success`` elements.

        Returns
        -------
        ElementList of Success
            Sequence of all ``st.success`` elements. Individual elements can be
            accessed from an ElementList by index (order on the page). For
            example, ``at.success[0]`` for the first element. Success is an
            extension of the Element class.
        )r]   successr   s    rR   r   zAppTest.successM  r   rQ   c                .    | j                   j                  S )av  Sequence of all ``st.status`` elements.

        Returns
        -------
        Sequence of Status
            Sequence of all ``st.status`` elements. Individual elements can be
            accessed from a Sequence by index (order on the page). For
            example, ``at.status[0]`` for the first element. Status is an
            extension of the Block class.
        )r]   statusr   s    rR   r   zAppTest.status[  r   rQ   c                .    | j                   j                  S )az  Sequence of all ``st.table`` elements.

        Returns
        -------
        ElementList of Table
            Sequence of all ``st.table`` elements. Individual elements can be
            accessed from an ElementList by index (order on the page). For
            example, ``at.table[0]`` for the first element. Table is an
            extension of the Element class.
        )r]   tabler   s    rR   r   zAppTest.tablei  r   rQ   c                .    | j                   j                  S )a  Sequence of all tabs within ``st.tabs`` elements.

        Each tab within a single ``st.tabs`` will be returned as a separate Tab
        in the Sequence. Additionally, the tab labels are forwarded to each
        Tab element as a property. For example, ``st.tabs("A","B")`` will
        yield two Tab objects, with ``Tab.label`` returning "A" and "B",
        respectively.

        Returns
        -------
        Sequence of Tab
            Sequence of all tabs within ``st.tabs`` elements. Individual
            tabs can be accessed from an ElementList by index (order on the
            page). For example, ``at.tabs[0]`` for the first tab. Tab is an
            extension of the Block class.
        )r]   tabsr   s    rR   r   zAppTest.tabsw  s    $ zzrQ   c                .    | j                   j                  S )au  Sequence of all ``st.text`` elements.

        Returns
        -------
        ElementList of Text
            Sequence of all ``st.text`` elements. Individual elements can be
            accessed from an ElementList by index (order on the page). For
            example, ``at.text[0]`` for the first element. Text is an
            extension of the Element class.
        )r]   textr   s    rR   r  zAppTest.text  r   rQ   c                .    | j                   j                  S )a  Sequence of all ``st.text_area`` widgets.

        Returns
        -------
        WidgetList of TextArea
            Sequence of all ``st.text_area`` widgets. Individual widgets can
            be accessed from a WidgetList by index (order on the page) or key.
            For example, ``at.text_area[0]`` for the first widget or
            ``at.text_area(key="my_key")`` for a widget with a given key.
        )r]   	text_arear   s    rR   r  zAppTest.text_area  r   rQ   c                .    | j                   j                  S )a  Sequence of all ``st.text_input`` widgets.

        Returns
        -------
        WidgetList of TextInput
            Sequence of all ``st.text_input`` widgets. Individual widgets can
            be accessed from a WidgetList by index (order on the page) or key.
            For example, ``at.text_input[0]`` for the first widget or
            ``at.text_input(key="my_key")`` for a widget with a given key.
        )r]   
text_inputr   s    rR   r  zAppTest.text_input  r   rQ   c                .    | j                   j                  S )a  Sequence of all ``st.time_input`` widgets.

        Returns
        -------
        WidgetList of TimeInput
            Sequence of all ``st.time_input`` widgets. Individual widgets can
            be accessed from a WidgetList by index (order on the page) or key.
            For example, ``at.time_input[0]`` for the first widget or
            ``at.time_input(key="my_key")`` for a widget with a given key.
        )r]   
time_inputr   s    rR   r  zAppTest.time_input  r   rQ   c                .    | j                   j                  S )az  Sequence of all ``st.title`` elements.

        Returns
        -------
        ElementList of Title
            Sequence of all ``st.title`` elements. Individual elements can be
            accessed from an ElementList by index (order on the page). For
            example, ``at.title[0]`` for the first element. Title is an
            extension of the Element class.
        )r]   titler   s    rR   r
  zAppTest.title  r   rQ   c                .    | j                   j                  S )az  Sequence of all ``st.toast`` elements.

        Returns
        -------
        ElementList of Toast
            Sequence of all ``st.toast`` elements. Individual elements can be
            accessed from an ElementList by index (order on the page). For
            example, ``at.toast[0]`` for the first element. Toast is an
            extension of the Element class.
        )r]   toastr   s    rR   r  zAppTest.toast  r   rQ   c                .    | j                   j                  S )a  Sequence of all ``st.toggle`` widgets.

        Returns
        -------
        WidgetList of Toggle
            Sequence of all ``st.toggle`` widgets. Individual widgets can
            be accessed from a WidgetList by index (order on the page) or key.
            For example, ``at.toggle[0]`` for the first widget or
            ``at.toggle(key="my_key")`` for a widget with a given key.
        )r]   toggler   s    rR   r  zAppTest.toggle  r   rQ   c                .    | j                   j                  S )a  Sequence of all ``st.warning`` elements.

        Returns
        -------
        ElementList of Warning
            Sequence of all ``st.warning`` elements. Individual elements can be
            accessed from an ElementList by index (order on the page). For
            example, ``at.warning[0]`` for the first element. Warning is an
            extension of the Element class.
        )r]   warningr   s    rR   r  zAppTest.warning  r   rQ   c                ,    t        | j                        S rO   )lenr]   r   s    rR   __len__zAppTest.__len__  s    4::rQ   c              #  8   K   | j                   E d {    y 7 wrO   r]   r   s    rR   __iter__zAppTest.__iter__  s     ::s   c                     | j                   |   S rO   r  )r^   idxs     rR   __getitem__zAppTest.__getitem__  s    zz#rQ   c                8    | j                   j                  |      S )a  Get elements or widgets of the specified type.

        This method returns the collection of all elements or widgets of
        the specified type on the current page. Retrieve a specific element by
        using its index (order on page) or key lookup.

        Parameters
        ----------
        element_type: str
            An element attribute of ``AppTest``. For example, "button",
            "caption", or "chat_input".

        Returns
        -------
        Sequence of Elements
            Sequence of elements of the given type. Individual elements can
            be accessed from a Sequence by index (order on the page). When
            getting and ``element_type`` that is a widget, individual widgets
            can be accessed by key. For example, ``at.get("text")[0]`` for the
            first ``st.text`` element or ``at.get("slider")(key="my_key")`` for
            the ``st.slider`` widget with a given key.
        )r]   get)r^   element_types     rR   r  zAppTest.get  s    . zz~~l++rQ   c                    t        |       S rO   )rA   r   s    rR   __repr__zAppTest.__repr__  s    T{rQ   )r_   
str | PathrW   float)rg   rU   rW   r   returnrI   )rg   zCallable[..., Any]rW   r   r!  rI   )r_   r  rW   r   r!  rI   )NN)r   zWidgetStates | Noner   float | Noner!  rI   )r   r"  r!  rI   )r   rU   r!  rI   )r!  r   )r!  zWidgetList[Button])r!  zWidgetList[ButtonGroup[Any]])r!  zElementList[Caption])r!  zWidgetList[ChatInput])r!  zSequence[ChatMessage])r!  zWidgetList[Checkbox])r!  zElementList[Code])r!  zWidgetList[ColorPicker])r!  zSequence[Column])r!  zElementList[Dataframe])r!  zWidgetList[DateInput])r!  zElementList[Divider])r!  zElementList[Error])r!  zElementList[Exception])r!  zSequence[Expander])r!  zElementList[Header])r!  zElementList[Info])r!  zElementList[Json])r!  zElementList[Latex])r!  zElementList[Markdown])r!  zElementList[Metric])r!  zWidgetList[Multiselect[Any]])r!  zWidgetList[NumberInput])r!  zWidgetList[Radio[Any]])r!  zWidgetList[SelectSlider[Any]])r!  zWidgetList[Selectbox[Any]])r!  zWidgetList[Slider[Any]])r!  zElementList[Subheader])r!  zElementList[Success])r!  zSequence[Status])r!  zElementList[Table])r!  zSequence[Tab])r!  zElementList[Text])r!  zWidgetList[TextArea])r!  zWidgetList[TextInput])r!  zWidgetList[TimeInput])r!  zElementList[Title])r!  zElementList[Toast])r!  zWidgetList[Toggle])r!  zElementList[Warning])r!  int)r  r#  r!  r-   )r  rU   r!  zSequence[Node])r!  rU   )=r}   
__module____qualname____doc__ra   classmethodrh   re   r   r   r   r   r   propertyr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r
  r  r  r  r  r  r  r  r  rP   rQ   rR   rI   rI   b   sy   6z  	. BC I I8 67d4

.3
	
 
 
 "#,
",
 	,
 
,
 ,
\ BC%>$%>:?%>	%> %>R -1 $>)> > 
	>@ .2 /.8 
 
 
" 
" ! ! ' ' " " % % ' ' # #   ' ' " "  $ $ % % " "     $ $ # # ! !         # # ! ! & & ' '     ( ( $ $ ! ! $ $ " " ! !      &   $ $ % % % %         ! ! " ",2rQ   rI   )b
__future__r   rk   rz   tempfilerq   r   pathlibr   typingr   r   r   unittest.mockr   urllibr	   r   r
   streamlit.runtimer   5streamlit.runtime.caching.storage.dummy_cache_storager   $streamlit.runtime.media_file_managerr   +streamlit.runtime.memory_media_file_storager   streamlit.runtime.pages_managerr   streamlit.runtime.secretsr   streamlit.runtime.state.commonr   *streamlit.runtime.state.safe_session_stater   %streamlit.runtime.state.session_stater   !streamlit.testing.v1.element_treer   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   (streamlit.testing.v1.local_script_runnerrB   streamlit.testing.v1.utilrC   streamlit.utilrD   rE   collections.abcrF    streamlit.proto.WidgetStates_pb2rG   TemporaryDirectoryro   rI   rP   rQ   rR   <module>r?     s    #       / / #  ! % B N 8 - 6 G >/ / / / / / / / / / / /` G : 3(=
%(
%
%
'| |rQ   