o
    h                     @   s|   d Z ddlZddlZddlmZmZmZ ddlT ejj	Z
dZdZdZejdd	d
d Zdd Zdd Zdd Zdd ZdS )zO
Basic tests of the stanza data objects, especially the setter/getter routines
    N)DocumentSentenceWord)*z%This is a test document. Pretty cool!))PRON_DTAUX_VBZDET_DTNOUN_NNr	   PUNCT_.)ADV_RBADJ_JJr
   z-Chris Manning wrote a sentence. Then another.module)scopec                  C   s   t jtdd} | S )Nen)dirlang)stanzaPipelineTEST_MODELS_DIR)nlp r   `/var/www/html/env_mimamsha/lib/python3.10/site-packages/stanza/tests/common/test_data_objects.pynlp_pipeline   s   r   c                 C   sX   t dd | t}|jdksJ tt d|_W d    d S 1 s%w   Y  d S )Nsome_property{   i  )r   add_propertyEN_DOCr   pytestraises
ValueErrorr   docr   r   r   test_readonly   s   "r"   c                 C   s:   t jddd d | t}ttdd |jD ksJ d S )N	upos_xposc                 S   s   | j  d| j S )N_)uposxposselfr   r   r   <lambda>!   s    ztest_getter.<locals>.<lambda>)getterc                 s   s$    | ]}t d d |jD V  qdS )c                 s   s    | ]}|j V  qd S N)r#   ).0wordr   r   r   	<genexpr>%   s    z(test_getter.<locals>.<genexpr>.<genexpr>N)tuplewords)r,   sentencer   r   r   r.   %   s   " ztest_getter.<locals>.<genexpr>)r   r   r   EN_DOC_UPOS_XPOSr/   	sentencesr    r   r   r   test_getter    s    r4   c                    sz   dddd ddddfd	d
}t jd fdd|d | t}|jd }d|_|jdks1J d|_|jdks;J d S )Nokgoodbad)r         r   r8   r9   )r5   r6   r7   c                    s    | | _ d S r+   
_classname)r(   value)str2intr   r   setter*   s   z"test_setter_getter.<locals>.setter	classnamec                    s   | j d ur
 | j  S d S r+   r:   r'   )int2strr   r   r)   ,   s    z$test_setter_getter.<locals>.<lambda>)r*   r>   )r   r   r   r3   r?   r;   )r   r>   r!   r1   r   )r@   r=   r   test_setter_getter'   s   
rA   c                 C   sj   | t }|jd }|j|jd u sJ t| d j|jd u s#J t| d j|jd u s3J d S )Nr   )EN_DOC2entssentr3   list
iter_wordsiter_tokens)r   r!   entr   r   r   test_backpointer7   s
   
 $rJ   )__doc__r   r   stanza.models.common.docr   r   r   stanza.testsmarkpipeline
pytestmarkr   r2   rC   fixturer   r"   r4   rA   rJ   r   r   r   r   <module>   s    

