o
    iF                     @   s  d Z ddlZddlmZ ddlmZ ddlZe ZejddZ	ejddZ
ejddZejd	dZejd
dZejddZdd Zdd Zdd ZejdkZerWdZdd Zndd Zejdk rjdZeedddZndd Zdd Ze	je	 e	 e	jd de	jd!de	jd"dejejjd#d$ d%Ze
je
 e
 e
jd de
jd&de
jd!de
jd"dej ej jd'd$ d%	Z!eje e ejd dejd&dejd!dej"ej"jd(d$ d%Z#eje e ejd dejd)dejd&dejd!dej$ej$jd*d$ d%	Z%eje ejd dejd)dejd&dejd!dejd+dej&d,d$ d-Z'eje d.ej&ej&jd/d$ d0Z(eje ejd dejd)dejd&dejd!dejd+dej)d1d$ d-Z*eje d2ej)ej)jd3d$ d0Z+dS )4z
Test runner for the JSON Schema official test suite

Tests comprehensive correctness of each draft's validator.

See https://github.com/json-schema-org/JSON-Schema-Test-Suite for details.
    N)bug)Suitedraft3)namedraft4draft6draft7zdraft2019-09zdraft2020-12c                    s    fdd}|S )Nc                    s"   t  fdd D rS d S )Nc                 3   s"    | ]\}}|t  |kV  qd S N)getattr).0attrvaluetest f/var/www/edux/Edux_v2/venv/lib/python3.10/site-packages/jsonschema/tests/test_jsonschema_test_suite.py	<genexpr>   s     z(skip.<locals>.skipper.<locals>.<genexpr>)allitemsr   kwargsmessager   r   skipper   s   zskip.<locals>.skipperr   )r   r   r   r   r   r   skip   s   r   c                    s    fdd}|S )Nc                    sF   | j }|du s|du sd|vs|d  jjv s| jrd S d|d S )NTFformatzFormat checker {0!r} not found.)schemaFORMAT_CHECKERcheckersvalidr   )r   r   	Validatorr   r   missing_format    s   z&missing_format.<locals>.missing_formatr   )r    r!   r   r   r   r!      s   r!   c                 C   sb   | j dkrd S d}t|dd| p0t|dd| p0t|dd| p0t|dd| p0t|dd| S )	Nemailz8Complex email validation is (intentionally) unsupported.zan invalid domainr   descriptionzan invalid IPv4-address-literalz!dot after local part is not validz"dot before local part is not validz3two subsequent dots inside local part are not valid)subjectr   r   r   r   r   r   complex_email_validation/   sJ   
	r'   i  z:Not running surrogate Unicode case, this Python is narrow.c                 C   s    t tdd| pt tdd| S )Nz7one supplementary Unicode code point is not long enoughr#   z4two supplementary Unicode code points is long enough)r   r   r   r   r   r   narrow_unicode_buildJ   s   r(   c                 C      d S r	   r   r   r   r   r   r(   U      )   	   zRejecting leading zeros is 3.9+ipv4z5invalid leading zeroes, as they are treated as octalsr   r%   r$   c                 C   r)   r	   r   r   r   r   r   allowed_leading_zerosa   r*   r/   c                 C   s   d}t |ddd| p[t |ddd| p[t |ddd| p[t |ddd| p[t |ddd| p[t |dd	d| p[t |dd
d| p[t |ddd| p[t |ddd| p[t |ddd| S )NzLeap seconds are unsupported.timez$a valid time string with leap secondr.   z*a valid time string with leap second, Zuluz0a valid time string with leap second with offsetz'valid leap second, positive time-offsetz'valid leap second, negative time-offsetz-valid leap second, large positive time-offsetz-valid leap second, large negative time-offsetz#valid leap second, zero time-offsetz	date-timez)a valid date-time with a leap second, UTCz7a valid date-time with a leap second, with minus offset)r   r&   r   r   r   leap_seconde   s    $r1   bignumznon-bmp-regexzeroTerminatedFloatsc                 C   s4   t | pttj| pt| ptt dddd| S )NrefF5$ref prevents a sibling id from changing the base uri)r   r%   r   case_description)r(   r!   
jsonschemaDraft3Validatorr'   r   r   r   r   r   r   <lambda>   s   r9   )r    format_checkerr   zfloat-overflowc                 C   s   t | p\t| p\t| p\ttj| p\t| p\tt ddd| p\tt ddd| p\tt ddd| p\tt ddd| p\tt dd	d| p\tt d
dd| p\tt ddd| S )Nr4   z$Recursive references between schemasr   r%   r6   zALocation-independent identifier with base URI change in subschemar5   idzmatch $ref to idr.   zno match on enum or $ref to id	refRemote,base URI change - change folder in subschemazEid must be resolved against nearest parent, not just immediate parent)	r(   r/   r1   r!   r7   Draft4Validatorr'   r   r   r   r   r   r   r9      s   
#(c                 C   sB   t | p t| p t| p ttj| p t| p tt ddd| S )Nr=   r>   r;   )	r(   r/   r1   r!   r7   Draft6Validatorr'   r   r   r   r   r   r   r9      s    zcross-draftc                 C   sV   t | p*t| p*t| p*ttj| p*t| p*tt ddd| p*tt ddd| S )Nr=   r>   r;   r4   F$id must be resolved against nearest parent, not just immediate parent)	r(   r/   r1   r!   r7   Draft7Validatorr'   r   r   r   r   r   r   r9     s0   
refOfUnknownKeywordc                 C   s*  t ddddd| pt dddd| pt dddd	d| pt ddd
dd| pt dddd| pt dddd| pt dddd| pt dddd| pt dddd| pt dddd| pt dddd| pt dddd| pt dddd| pt dddd| pt t ddd| pt t dd d| S )!Nz'recursiveRef support isn't working yet.recursiveRefzL$recursiveRef with no $recursiveAnchor in the initial target schema resourcez9leaf node does not match: recursion uses the inner schema)r   r%   r6   r$   z2leaf node matches: recursion uses the inner schemar.   zJdynamic $recursiveRef destination (not predictable at schema compile time)zinteger nodez3multiple dynamic paths to the $recursiveRef keyword/recurse to integerNode - floats are not allowedz*integer does not match as a property valuez:leaf node does not match: recursion only uses inner schemaz3leaf node matches: recursion only uses inner schemaz6two levels, integer does not match as a property valuezrecursive mismatchztwo levels, no matchr<   z4Invalid use of fragments in location-independent $idr;   +dynamicRef support isn't fully working yet.defsinvalid definition schemaanchor$same $anchor with different base uri(Vocabulary support is still in-progress.
vocabulary5no validation: invalid number, but it still validatesr4   rA   r=   (remote HTTP ref with nested absolute ref)r   r   r   r   r   r   r9   '  s  
!&.6=BGNSX_g)r    r   TestDraft201909Formatc                 C   .   t | pt| pt| pttj| pt | S r	   )r'   r/   r1   r!   r7   Draft201909Validatorr   r   r   r   r9        )r   r    r:   r   c                 C   s  t | ptdddd| ptddddd| ptddddd| ptdddd	d| ptdddd	d| ptddd
d| ptdddd| ptdddd| ptdddd| ptdddd| ptdddd| ptdddd| ptt ddd| ptt ddd| S )NrF   
dynamicRefz0The recursive part is not valid against the rootr.   zincorrect extended schemaz>$ref and $dynamicAnchor are independent of order - $defs first)r   r%   r$   r6   zcorrect extended schemaz=$ref and $dynamicAnchor are independent of order - $ref firstz8/then/$defs/thingy is the final stop for the $dynamicRefzDstring matches /$defs/thingy, but the $dynamicRef does not stop hererE   rG   rH   rI   rJ   r;   rK   rL   rM   r4   rA   r=   rN   )r(   r   r   r   r   r   r   r9     s    (/7?DINU]TestDraft202012Formatc                 C   rP   r	   )r'   r/   r1   r!   r7   Draft202012Validatorr   r   r   r   r9     rR   ),__doc__sysjsonschema.tests._helpersr   jsonschema.tests._suiter   r7   SUITEversionDRAFT3DRAFT4DRAFT6DRAFT7DRAFT201909DRAFT202012r   r!   r'   
maxunicodeis_narrow_buildr   r(   version_infor/   r1   to_unittest_testcasetestsformat_testsoptional_tests_ofr8   r   
TestDraft3r?   
TestDraft4r@   
TestDraft6rB   
TestDraft7rQ   TestDraft201909rO   rU   TestDraft202012rT   r   r   r   r   <module>   s    


-






>






 




y




o
