�
PiEh�H �
�X � d Z ddlZddlmc mZ ddlZddlm Z m
Z
mZ ddlZddl
Z
ej j de
j j! e
j j! e
j j! e� � � � G d� d� Z G d� d� Z G d� d � Zy)
z-UI endpoint smoke tests for Gradio interface.� N)�Mock�patch� MagicMockc �X � e Zd ZdZd� Zd� Zd� Zd� Zd� Zd� Z d� Z
d � Zd
� Zd� Z
d� Zd
� Zy)�TestUIEndpointsz&Test Gradio UI endpoints and wrappers.c � � t d� 5 t d� 5 t d� 5 ddlm} t d� 5 }ddd d
dgd�d
f|j _ |d� }t |� }d}||k( }|s�t
j d|fd||f� dt j � v st
j t
� rt
j t
� nddt j � v st
j |� rt
j |� ndt
j |� t
j |� d�z }dd|iz }t t
j |� � �dx}x}}|d d } d}
| |
k( }|slt
j d|fd| |
f� t
j | � t
j |
� d�z }dd|iz }t t
j |� � �dx} x}}
d} |d }
| |
v }|slt
j d|fd| |
f� t
j | � t
j |
� d�z }dd|iz }t t
j |� � �dx} x}}
|j j � ddd� ddd� ddd� ddd� y# 1 sw Y �"xY w# 1 sw Y �&xY w# 1 sw Y �*xY w# 1 sw Y yxY w) z-Test the agent_orchestrator wrapper function.� modal.App�modal.Image�tavily.TavilyClientr ��agent_orchestrator�app.orchestrator�successz
Test researchz
print('test')�testz
Test citation��status�research_summary�generated_code�execution_result� citationszTest summaryzCreate a test script� ��==�z0%(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)s�len�result��py0�py1�py3�py6�assert %(py8)s�py8Nr �z%(py1)s == %(py4)s�r �py4�assert %(py6)sr! r ��in�z%(py1)s in %(py4)s)r �appr
�orchestrate�return_valuer �
@pytest_ar�_call_reprcompare�@py_builtins�locals�_should_repr_global_name� _saferepr�AssertionError�_format_explanation�assert_called_once)�selfr
�mock_orchestratorr �@py_assert2�@py_assert5�@py_assert4�@py_format7�@py_format9�@py_assert0�@py_assert3�@py_format5s �SC:\Users\User\PythonProjects\mcp_hub_project\tests\integration\test_ui_endpoints.py�test_agent_orchestrator_wrapperz/TestUIEndpoints.test_agent_orchestrator_wrapper s � �
�;�
� C�
�=�
!� C�
�(�
)� C�
/��)�*�
C�.?� #,�,;�*9�,2�&5�%6�� #� >�!�-�-�:� ,�,B�C�� �6�{�'�a�'�{�a�'�'�'�'�{�a�'�'�'�'�'�'�s�'�'�'�s�'�'�'�'�'�'�6�'�'�'�6�'�'�'�{�'�'�'�a�'�'�'�'�'�'�'��a�y��*�7�i�7�*�i�7�7�7�7�*�i�7�7�7�*�7�7�7�i�7�7�7�7�7�7�7�)�6�V�A�Y�6�)�Y�6�6�6�6�)�Y�6�6�6�)�6�6�6�Y�6�6�6�6�6�6�6�!�-�-�@�@�B�)
C�
C� C� C� C�
C�
C��
C� C�� C� C�� C� C�sQ �K
�J>�J2�IJ& �J2�
J>�K
�&J/
�+J2�2J;�7J>�>K �K
�
Kc � � t d� 5 t d� 5 t d� 5 ddlm} t d� 5 }dg d�i|j _ |d d
� }d}||v }|s�t j d|fd||f� t j |� d
t j � v st j |� rt j |� nd
d�z }dd|iz }t t j |� � �dx}}|d }t |� } d
}
| |
k( }|s�t j d|fd| |
f� dt j � v st j t � rt j t � ndt j |� t j | � t j |
� d�z }dd|iz }
t t j |
� � �dx}x} x}}
|j j d d
� ddd� ddd� ddd� ddd� y# 1 sw Y �"xY w# 1 sw Y �&xY w# 1 sw Y �*xY w# 1 sw Y yxY w)z2Test the agent_question_enhancer wrapper function.r r
r r )�agent_question_enhancer�app.question_enhancer�
sub_questions)zHow to create a script?zWhat libraries to use?zHow to test the code?zCreate a Python script� r( �z%(py1)s in %(py3)sr �r r �assert %(py5)s�py5Nr �z0%(py4)s
{%(py4)s = %(py0)s(%(py2)s)
} == %(py7)sr �r �py2r&