o
    QDi                     @   s   d dl Z d dlZd dlZd dlmZmZ dZdddddd	id
dddddd	idgiZdddddddgiZddddidddddddddddddgdgdgddgddgg ddZ	dd Z
dd  Zd!d" Zd#d$ Zd%d& Zd'd( Zd)d* ZdS )+    N)FrictionlessExceptionSchemazdata/fixtures/output-unzippedfieldsidzAny positive integerintegerminimum   )namedescriptiontypeconstraintsageAgezAny number >= 1number)r	   titler
   r   r   string)r	   r   heightrequiredT)r	   r   r   r	   
occupation )resourcer   )r   	reference)r   -null)r   
primaryKeyforeignKeysmissingValuesc                  C   s6   t d} |  }| |usJ |  | ksJ d S )Nzdata/table.csv)r   describeto_copyto_descriptor)sourcetarget r"   b/var/www/Datamplify/venv/lib/python3.10/site-packages/frictionless/schema/__spec__/test_convert.pytest_schema_to_copy3   s   
r$   c                 C   j   t | d}tt}|| t|dd}| t	|ks#J W d    d S 1 s.w   Y  d S )Nzschema.jsonutf-8encoding)
strjoinr   from_descriptorDESCRIPTOR_MINto_jsonopenr   jsonloadtmpdiroutput_file_pathschemafiler"   r"   r#   test_schema_to_json:      

"r6   c                 C   r%   )Nzschema.yamlr&   r'   )
r)   r*   r   r+   r,   to_yamlr.   r   yaml	safe_loadr1   r"   r"   r#   test_schema_to_yamlB   r7   r;   c                  C   sL   t t} |  }|dr"|dr"|dr"|dr"|ds$J d S )Nz%| name       | type    | required   |z%| id         | string  | True       |z%| height     | number  |            |z%| age        | integer |            |z%| name       | string  |            |)r   r+   DESCRIPTOR_MAX
to_summarycount)r4   outputr"   r"   r#   test_schema_to_summaryM   s   

r@   c                  C   sh   dddddddddddddgi} t | }| }|dr0|d	r0|d
r0|ds2J d S )Nr   test_1r   defaultr	   r   formattest_2test_3 | name   | type   | required   |z | test_1 | string |            |z | test_2 | string |            |z | test_3 | string |            |r   r+   r=   r>   
descriptorr4   r?   r"   r"   r#   'test_schema_to_summary_without_requiredY   s    




rK   c                  C   sd   dddddddddddgi} t | }| }|d	r.|d
r.|dr.|ds0J d S )Nr   r   rB   )r	   rD   r	   r   rC   r   rG   z | id     | string |            |z | name   | string |            |z | age    | string |            |rH   rI   r"   r"   r#   8test_schema_to_summary_with_type_missing_for_some_fieldsk   s    


rL   c                  C   s~   dddddddddddgi} t t}t|  W d    n1 s&w   Y  |jj}|jdks6J |jd	ks=J d S )
Nr   r   rB   )r   rD   r	   r   rC   zschema-errorzProvided schema is not valid.)	pytestraisesr   r   r+   valueerrorr   r
   )rJ   excinforP   r"   r"   r#   8test_schema_to_summary_with_name_missing_for_some_fields}   s   
rR   )r/   rM   r9   frictionlessr   r   UNZIPPED_DIR
DESCRIPTORr,   r<   r$   r6   r;   r@   rK   rL   rR   r"   r"   r"   r#   <module>   sT    