
    g!                     
   d Z ddlZddlmZ ddlZ e       Zej                  d      Zej                  d      Zej                  d      Z	ej                  d      Z
ej                  d	      Zej                  d
      Zd Zd Zd Zej                   dk  rdZ eedd      Znd Zd Zej)                  ej+                         ej-                         ej/                  d      ej/                  d      ej/                  d      ej0                  ej0                  j2                  d       Zej)                  ej+                         ej-                         ej/                  d      ej/                  d      ej/                  d      ej/                  d      ej/                  d      ej6                  ej6                  j2                  d 
      Ze	j)                  e	j+                         e	j-                         e	j/                  d      e	j/                  d      e	j/                  d      e	j/                  d      ej:                  ej:                  j2                  d 	      Ze
j)                  e
j+                         e
j-                         e
j/                  d      e
j/                  d      e
j/                  d      e	j/                  d      e
j/                  d      e
j/                  d      ej>                  ej>                  j2                  d        Z ej)                  ej+                         ej/                  d!      ej/                  d      ej/                  d      ej/                  d      ej/                  d      ej/                  d"      ej/                  d      ej/                  d#      ej/                  d      ejB                   ed$d%d&      '      Z"ej)                  ej-                         d(ejB                  ejB                  j2                  d) *      Z#ej)                  ej+                         ej/                  d!      ej/                  d      ej/                  d      ej/                  d      ej/                  d      ej/                  d"      ej/                  d      ej/                  d#      ej/                  d      ejH                   ed$d%d&      '      Z%ej)                  ej-                         d+ejH                  ejH                  j2                  d, *      Z&y)-z
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)Suitedraft3)namedraft4draft6draft7zdraft2019-09zdraft2020-12c                       fd}|S )Nc                 P     t         fdj                         D              rS y )Nc              3   B   K   | ]  \  }}|t        |      k(    y wN)getattr).0attrvaluetests      `/var/www/openai/venv/lib/python3.12/site-packages/jsonschema/tests/test_jsonschema_test_suite.py	<genexpr>z(skip.<locals>.skipper.<locals>.<genexpr>   s"     N~eud++~s   )allitems)r   kwargsmessages   `r   skipperzskip.<locals>.skipper   s"    Nv||~NNN O     )r   r   r   s   `` r   skipr      s     Nr   c                       fd}|S )Nc                     | j                   }|du s/|du s+d|vs'|d   j                  j                  v s| j                  ry d|d   dS )NTFformatzFormat checker z not found.)schemaFORMAT_CHECKERcheckersvalid)r   r   	Validators     r   missing_formatz&missing_format.<locals>.missing_format   sZ    dNv%h9#;#;#D#DDzz !1 4K@@r   r   )r#   r$   s   ` r   r$   r$      s    A r   c                     | j                   dk7  ry d} t        |d      |       xsR  t        |d      |       xs=  t        |d      |       xs(  t        |d      |       xs  t        |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   s     r   complex_email_validationr*   .   s    ||wHG4'  t5 t7 t8 tI r   )   	   zRejecting leading zeros is 3.9+ipv4z5invalid leading zeroes, as they are treated as octalsr   r(   r'   c                      y r   r   r   s    r   allowed_leading_zerosr1   M   s    r   c                    d} t        |dd      |       xs  t        |dd      |       xs  t        |dd      |       xs  t        |dd      |       xs  t        |dd      |       xsl  t        |dd	      |       xsV  t        |dd
      |       xs@  t        |dd      |       xs*  t        |dd      |       xs  t        |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)   s     r   leap_secondr4   Q   ss   -G4: 	 (t@ 		(tF 	(t= 	( t= 	!((tC 	)(0tC 	1(8t9 	9(@t? 	A(HtM 	I(r   bignumznon-bmp-regexzeroTerminatedFloatsc                 Z     t        t        j                        |       xs t        |       S r   )r$   
jsonschemaDraft3Validatorr*   r0   s    r   <lambda>r:      s)    2z11248 	*#D)	*r   )r#   format_checkerr   zfloat-overflowidc                     t        |       xs9 t        |       xs,  t        t        j                        |       xs t        |       S r   )r1   r4   r$   r8   Draft4Validatorr*   r0   s    r   r:   r:      E    d# 	*t	*5>*445d;	* $D)	*r   c                     t        |       xs9 t        |       xs,  t        t        j                        |       xs t        |       S r   )r1   r4   r$   r8   Draft6Validatorr*   r0   s    r   r:   r:      r?   r   zcross-draftunknownKeywordc                     t        |       xs9 t        |       xs,  t        t        j                        |       xs t        |       S r   )r1   r4   r$   r8   Draft7Validatorr*   r0   s    r   r:   r:      r?   r   anchorz	no-schemarefOfUnknownKeywordz(Vocabulary support is still in-progress.
vocabularyz5no validation: invalid number, but it still validates)r#   r   TestDraft201909Formatc                     t        |       xsF t        |       xs9 t        |       xs,  t        t        j
                        |       xs t        |       S r   )r*   r1   r4   r$   r8   Draft201909Validatorr0   s    r   r:   r:      T     & 	* &	*t	* ;>*99:4@	* $D)		*r   )r   r#   r;   r   TestDraft202012Formatc                     t        |       xsF t        |       xs9 t        |       xs,  t        t        j
                        |       xs t        |       S r   )r*   r1   r4   r$   r8   Draft202012Validatorr0   s    r   r:   r:     rK   r   )'__doc__sysjsonschema.tests._suiter   r8   SUITEversionDRAFT3DRAFT4DRAFT6DRAFT7DRAFT201909DRAFT202012r   r$   r*   version_infor   r1   r4   to_unittest_testcasecasesformat_casesoptional_cases_ofr9   r    
TestDraft3r>   
TestDraft4rA   
TestDraft6rD   
TestDraft7rJ   TestDraft201909rH   rN   TestDraft202012rL   r   r   r   <module>re      sU    ) 	H	%	H	%	H	%	H	%mmm0mmm0 . f/G K*Z ((
LLN

(+
/2
"89((--<<
 ) 
 ((
LLN

(+
"23
$'
/2
"89((--<<
 ) 
& ((
LLN

(+
"23
$'
/2((--<<
 ) 
$ ((
LLN

(+
-0
"23
$'
/2
"23((--<<
 ) 
( 22!!x!0!!x!0!!}!5!!'7!8!!t!,!!{!3!!!7!!'<!=!!'7!8--	:C	
 3 , $88	 --22AA
 9   22!!x!0!!x!0!!}!5!!'7!8!!t!,!!{!3!!!7!!'<!=!!'7!8--	:C	
 3 , $88	 --22AA
 9  r   