o
    i,                  	   @   s  U d dl mZ d dlmZmZ d dlZd dlZd dlmZ d dl	m
Z
 d dlmZmZmZmZ e Zddd	d
dddddddgdddgddddgdgddddgdgdZeeef ed< ejd d!d"ejfd#d$Zd$efd%d&Zd'd( Zejd)ed"ejd)efd*d+ZdS ),    )Path)AnyDictN)	CliRunner)app)
MARKER_ENDMARKER_IGNOREMARKER_STARTMARKER_TAGSzSample projectzThis is a project for testingzassets/weasel-readme.mdzZhttps://github.com/explosion/weasel/raw/9a3632862b47069d2f9033b773e814d4c4e09c83/README.md 65f4c426a9b153b7683738c92d0d20f9)desturlchecksumzassets/pyproject.tomlz_https://github.com/explosion/weasel/raw/9a3632862b47069d2f9033b773e814d4c4e09c83/pyproject.toml 1e2da3a3030d6611520952d5322cd94eT)r   r   r   extraokzprint okzpython -c "print('okokok')")namehelpscriptcreatezmake a fileztouch abc.txtzabc.txt)r   r   r   outputscleanzremove test filez
rm abc.txt)titledescriptionassetscommandsSAMPLE_PROJECTfunction)scopetmp_path_factoryc                 C   s&   |  d}|d }|tt |S )Nprojectproject.yml)mktemp
write_textsrsly
yaml_dumpsr   )r   test_dirpath r(   R/home/ubuntu/.local/lib/python3.10/site-packages/weasel/tests/cli/test_document.pyproject_yaml_file2   s   
r*   c                 C   sD   t tdt| jg}t| }|jdksJ |d |jv s J d S )Ndocumentr   r   )	runnerinvoker   strparentr$   	read_yaml	exit_codestdout)r*   result	conf_datar(   r(   r)   test_create_docs<   s   
r5   c                  C   s    t tdg} | jdksJ d S )Nr+      )r,   r-   r   r1   )r3   r(   r(   r)   test_raise_error_no_configC   s   r7   markerc           	   	   C   s*  ddd}d}|  d}|d }|t| t|d dd	d
4}ttdt|j	gj
}tttfD ]}||jdd|j|d}q3|| || W d   n1 sXw   Y  ttdt|j	dt|d g t|d dd	d
}|d| v sJ W d   dS 1 sw   Y  dS )zJWeasel should be able to handle both 'SPACY PROJECT' and 'WEASEL' markers.zAwesome projectz9Project using spacy projects and gets migrated to weasel.)r   r   z

## Some additional information

Here is some additional information about this project that is not autogenerated from the [`project.yml`](project.yml).r    r!   z	readme.mdzw+zutf-8)encodingr+   WEASEL)tagNz--outputr )r"   r#   r$   r%   openr,   r-   r   r.   r/   outputr	   r   r   replaceformat
writelinesjoin	readlines)	r   r8   r    additional_textr&   r'   filereadme
to_replacer(   r(   r)   test_markersH   s.   


"rI   )pathlibr   typingr   r   pytestr$   typer.testingr   weaselr   weasel.cli.documentr   r   r	   r
   r,   r   r.   __annotations__fixtureTempPathFactoryr*   r5   r7   markparametrizerI   r(   r(   r(   r)   <module>   sV    
%	