
    
iO                         d dl Zd dlmc mZ d dlZej                  j                  d d       d dl	Z	d dl
m
Z
 d dlmZ d Zd Zy)    Nz!/home/jang/Projects/ai-researcher)datetime)Messagec                     t        dddddid      } | j                  }d}||k(  }|st        j                  d|fd	||f      d
t	        j
                         v st        j                  |       rt        j                  |       nd
t        j                  |      t        j                  |      dz  }dd|iz  }t        t        j                  |            dx}x}}| j                  }d}||k(  }|st        j                  d|fd||f      d
t	        j
                         v st        j                  |       rt        j                  |       nd
t        j                  |      t        j                  |      dz  }dd|iz  }t        t        j                  |            dx}x}}| j                  }d}||k(  }|st        j                  d|fd||f      d
t	        j
                         v st        j                  |       rt        j                  |       nd
t        j                  |      t        j                  |      dz  }dd|iz  }t        t        j                  |            dx}x}}| j                  }ddi}||k(  }|st        j                  d|fd||f      d
t	        j
                         v st        j                  |       rt        j                  |       nd
t        j                  |      t        j                  |      dz  }dd|iz  }t        t        j                  |            dx}x}}| j                  }d}||k(  }|st        j                  d|fd||f      d
t	        j
                         v st        j                  |       rt        j                  |       nd
t        j                  |      t        j                  |      dz  }dd|iz  }t        t        j                  |            dx}x}}y)u   测试Message创建msg_123conv_456	assistanttextu   技术部有15名员工	trace_789)idconversation_idrolecontenttrace_id==)z*%(py2)s
{%(py2)s = %(py0)s.id
} == %(py5)smsgpy0py2py5assert %(py7)spy7N)z7%(py2)s
{%(py2)s = %(py0)s.conversation_id
} == %(py5)s)z,%(py2)s
{%(py2)s = %(py0)s.role
} == %(py5)s)z/%(py2)s
{%(py2)s = %(py0)s.content
} == %(py5)s)z0%(py2)s
{%(py2)s = %(py0)s.trace_id
} == %(py5)s)r   r   
@pytest_ar_call_reprcompare@py_builtinslocals_should_repr_global_name	_safereprAssertionError_format_explanationr   r   r   r   )r   @py_assert1@py_assert4@py_assert3@py_format6@py_format8s         B/home/jang/Projects/ai-researcher/tests/unit/test_message_model.pytest_message_creationr'      sR   
"23C 66Y6Y6Y336Y,*,*,,,,*,,,,,,3,,,3,,,,,,*,,,,,,,88"{"8{""""8{""""""3"""3"""8"""{""""""";;=6#<==;=====;=======3===3===;===========<<&;&<;&&&&<;&&&&&&3&&&3&&&<&&&;&&&&&&&    c                     t         j                  } d}| |k(  }|st        j                  d|fd| |f      dt	        j
                         v st        j                  t               rt        j                  t               ndt        j                  |       t        j                  |      dz  }dd|iz  }t        t        j                  |            dx} x}}t         j                  } d	}| |k(  }|st        j                  d|fd
| |f      dt	        j
                         v st        j                  t               rt        j                  t               ndt        j                  |       t        j                  |      dz  }dd|iz  }t        t        j                  |            dx} x}}t         j                  } d}| |k(  }|st        j                  d|fd| |f      dt	        j
                         v st        j                  t               rt        j                  t               ndt        j                  |       t        j                  |      dz  }dd|iz  }t        t        j                  |            dx} x}}y)u   测试消息角色枚举userr   )z1%(py2)s
{%(py2)s = %(py0)s.ROLE_USER
} == %(py5)sr   r   r   r   Nr   )z6%(py2)s
{%(py2)s = %(py0)s.ROLE_ASSISTANT
} == %(py5)ssystem)z3%(py2)s
{%(py2)s = %(py0)s.ROLE_SYSTEM
} == %(py5)s)r   	ROLE_USERr   r   r   r   r   r   r   r    ROLE_ASSISTANTROLE_SYSTEM)r!   r"   r#   r$   r%   s        r&   test_message_rolesr/      sX   &&&&&&&&&&&&7&&&7&&&&&&&&&&&&&!!0[0![0000![00000070007000!000[0000000*(*(****(******7***7******(*******r(   )builtinsr   _pytest.assertion.rewrite	assertionrewriter   syspathinsertpytestr   src.models.messager   r'   r/    r(   r&   <module>r:      s2      
 6 7   &'"+r(   