
    dD$                     V    d dl mZ d dlZd dlZd dlZd dlmZmZ  G d de          ZdS )    )TestCaseN)FormatChecker
validatorsc                   V    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd ZdS )TestDeprecationsc                 *   |                      t                    5 }ddlm} ddd           n# 1 swxY w Y   |                     |j        t                     |                     t          |j	                  
                    d                     dS )zY
        As of v4.0.0, __version__ is deprecated in favor of importlib.metadata.
        r   )__version__Nz.Accessing jsonschema.__version__ is deprecated)assertWarnsDeprecationWarning
jsonschemar	   assertEqualfilename__file__
assertTruestrwarning
startswith)selfwr	   s      f/home/feoh/.local/pipx/venvs/poetry/lib/python3.11/site-packages/jsonschema/tests/test_deprecations.pytest_versionzTestDeprecations.test_version
   s    
 011 	/Q......	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	X...	NN%%@ 	
 	
 	
 	
 	
   .22c                 *   |                      t                    5 }ddlm} ddd           n# 1 swxY w Y   |                     |j        t                     |                     t          |j	                  
                    d                     dS )z
        As of v4.0.0, importing ErrorTree from jsonschema.validators is
        deprecated in favor of doing so from jsonschema.exceptions.
        r   )	ErrorTreeNz<Importing ErrorTree from jsonschema.validators is deprecated)r
   r   jsonschema.validatorsr   r   r   r   r   r   r   r   )r   r   r   s      r   test_validators_ErrorTreez*TestDeprecations.test_validators_ErrorTree   s     011 	8Q777777	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	X...	NN%%N 	
 	
 	
 	
 	
r   c                 v   |                      t                    5 }t          j        }ddd           n# 1 swxY w Y   |                     |t          j                   |                     |j        t                     |                     t          |j	                  
                    d                     dS )za
        As of v4.0.0, accessing jsonschema.validators.validators is
        deprecated.
        Nz8Accessing jsonschema.validators.validators is deprecated)r
   r   r   r   _VALIDATORSr   r   r   r   r   r   r   r   values      r   test_validators_validatorsz+TestDeprecations.test_validators_validators)   s     011 	*Q)E	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	*
 6777X...	NN%%J 	
 	
 	
 	
 	
   488c                 v   |                      t                    5 }t          j        }ddd           n# 1 swxY w Y   |                     |t          j                   |                     |j        t                     |                     t          |j
                                      d                     dS )zc
        As of v4.0.0, accessing jsonschema.validators.meta_schemas is
        deprecated.
        Nz:Accessing jsonschema.validators.meta_schemas is deprecated)r
   r   r   meta_schemasr   _META_SCHEMASr   r   r   r   r   r   r   s      r   test_validators_meta_schemasz-TestDeprecations.test_validators_meta_schemas:   s     011 	,Q+E	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	,
 8999X...	NN%%L 	
 	
 	
 	
 	
r"   c                    t           j                            i           }|                     t                    5 }|                    d          5  	 ddd           n# 1 swxY w Y   ddd           n# 1 swxY w Y   |                     |j        t                     | 	                    t          |j                                      d                     dS )zC
        As of v4.0.0, RefResolver.in_scope is deprecated.
        fooNz.jsonschema.RefResolver.in_scope is deprecated )r   RefResolverfrom_schemar
   r   in_scoper   r   r   r   r   r   r   )r   resolverr   s      r   test_RefResolver_in_scopez*TestDeprecations.test_RefResolver_in_scopeK   sE   
 )55b99011 	Q""5))                	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	X...	NN%%@ 	
 	
 	
 	
 	
s5   A5AA5A"	"A5%A"	&A55A9<A9c                    t          j        i           }|                     t                    5 }|                    dddi          }ddd           n# 1 swxY w Y   |                     |           |                     |j        t                     | 	                    t          |j                                      d                     dS )zz
        As of v4.0.0, calling is_valid with two arguments (to provide a
        different schema) is deprecated.
        r(   typenumberNz5Passing a schema to Validator.is_valid is deprecated )r   Draft7Validatorr
   r   is_validassertFalser   r   r   r   r   r   r   )r   	validatorr   results       r   %test_Validator_is_valid_two_argumentsz6TestDeprecations.test_Validator_is_valid_two_arguments\   s    .r22	011 	CQ''/ABBF	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	   X...	NN%%G 	
 	
 	
 	
 	
s   AAAc                    t          j        i           }|                     t                    5 }|                    dddi          \  }ddd           n# 1 swxY w Y   |                     |j        d           |                     |j        t                     | 	                    t          |j                                      d                     dS )z}
        As of v4.0.0, calling iter_errors with two arguments (to provide a
        different schema) is deprecated.
        r(   r/   r0   Nz8Passing a schema to Validator.iter_errors is deprecated )r   r1   r
   r   iter_errorsr   r4   r   r   r   r   r   r   )r   r4   r   errors       r   (test_Validator_iter_errors_two_argumentsz9TestDeprecations.test_Validator_iter_errors_two_argumentsn   s    .r22	011 	FQ**5682DEEFE	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	&111X...	NN%%J 	
 	
 	
 	
 	
s   AAAc                    |                      t                    5 } G d dt          j                  }ddd           n# 1 swxY w Y   |                     |j        t                     |                     t          |j	                  
                    d                     |                      t                    5 } G d dt          j        i                     }ddd           dS # 1 swxY w Y   dS )ac  
        As of v4.12.0, subclassing a validator class produces an explicit
        deprecation warning.

        This was never intended to be public API (and some comments over the
        years in issues said so, but obviously that's not a great way to make
        sure it's followed).

        A future version will explicitly raise an error.
        c                       e Zd ZdS )=TestDeprecations.test_Validator_subclassing.<locals>.SubclassN__name__
__module____qualname__     r   Subclassr=              rC   rD   Nz!Subclassing validator classes is c                       e Zd ZdS )DTestDeprecations.test_Validator_subclassing.<locals>.AnotherSubclassNr>   rB   rC   r   AnotherSubclassrG      rE   rC   rH   )meta_schema)r
   r   r   Draft202012Validatorr   r   r   r   r   r   r   create)r   r   rD   rH   s       r   test_Validator_subclassingz+TestDeprecations.test_Validator_subclassing   s    011 	Q    ::   	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	X...	NN%%&IJJ	
 	
 	
 011 	Q    *"3"C"C"C   	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s#   A  AA?"C..C25C2c                    |                      t          j        j        dd           |                     t
                    5 }t          j        d           ddd           n# 1 swxY w Y   |                     |j        t                     | 
                    t          |j                                      d                     dS )zd
        As of v4.14.0, FormatChecker.cls_checks is deprecated without
        replacement.
        boomNzFormatChecker.cls_checks )
addCleanupr   checkerspopr
   r   
cls_checksr   r   r   r   r   r   r   )r   r   s     r   test_FormatChecker_cls_checksz.TestDeprecations.test_FormatChecker_cls_checks   s     	.2FDAAA011 	-Q$V,,,	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	X...	NN%%&ABB	
 	
 	
 	
 	
s   A""A&)A&c                 `	   |                      t                    5 }ddlm} ddd           n# 1 swxY w Y   |                     |t
          j        j                   |                     |j	        t                     |                     t          |j                                      d          |j                   |                      t                    5 }ddlm} ddd           n# 1 swxY w Y   |                     |t
          j        j                   |                     |j	        t                     |                     t          |j                                      d          |j                   |                      t                    5 }ddlm} ddd           n# 1 swxY w Y   |                     |t
          j        j                   |                     |j	        t                     |                     t          |j                                      d	          |j                   |                      t                    5 }dd
lm} ddd           n# 1 swxY w Y   |                     |t
          j        j                   |                     |j	        t                     |                     t          |j                                      d          |j                   |                      t                    5 }ddlm} ddd           n# 1 swxY w Y   |                     |t
          j        j                   |                     |j	        t                     |                     t          |j                                      d          |j                   |                      t                    5 }ddlm} ddd           n# 1 swxY w Y   |                     |t
          j        j                   |                     |j	        t                     |                     t          |j                                      d          |j                   |                     t4                    5  ddlm} ddd           dS # 1 swxY w Y   dS )z
        As of v4.16.0, accessing jsonschema.draftn_format_checker is deprecated
        in favor of Validator.FORMAT_CHECKER.
        r   )draft202012_format_checkerNz3Accessing jsonschema.draft202012_format_checker is )msg)draft201909_format_checkerz3Accessing jsonschema.draft201909_format_checker is )draft7_format_checkerz.Accessing jsonschema.draft7_format_checker is )draft6_format_checkerz.Accessing jsonschema.draft6_format_checker is )draft4_format_checkerz.Accessing jsonschema.draft4_format_checker is )draft3_format_checkerz.Accessing jsonschema.draft3_format_checker is )draft1234_format_checker)r
   r   r   rU   assertIsr   rJ   FORMAT_CHECKERr   r   r   r   r   r   r   rW   Draft201909ValidatorrX   r1   rY   Draft6ValidatorrZ   Draft4Validatorr[   Draft3ValidatorassertRaisesImportErrorr\   )	r   r   rU   rW   rX   rY   rZ   r[   r\   s	            r   test_draftN_format_checkerz+TestDeprecations.test_draftN_format_checker   sd    011 	>Q======	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	&+:	
 	
 	
 	X...	NN%%E  		 	 	
 	
 	
 011 	>Q======	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	&+:	
 	
 	
 	X...	NN%%E  		 	 	
 	
 	
 011 	9Q888888	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	!&5	
 	
 	
 	X...	NN%%@  		 	 	
 	
 	
 011 	9Q888888	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	!&5	
 	
 	
 	X...	NN%%@  		 	 	
 	
 	
 011 	9Q888888	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	!&5	
 	
 	
 	X...	NN%%@  		 	 	
 	
 	
 011 	9Q888888	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	!&5	
 	
 	
 	X...	NN%%@  		 	 	
 	
 	
 {++ 	< 	<;;;;;;	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	<sx   .22C,,C03C0F**F.1F.I((I,/I,L&&L*-L*O$$O(+O(R##R'*R'c                 b   |                      t                    5 }ddl}t          j        |j                   ddd           n# 1 swxY w Y   |                     |j        t          j                   | 	                    t          |j                                      d                     dS )zH
        As of v4.17.0, importing jsonschema.cli is deprecated.
        r   Nz5The jsonschema CLI is deprecated and will be removed )r
   r   jsonschema.cli	importlibreloadclir   r   r   r   r   r   r   )r   r   r   s      r   test_import_cliz TestDeprecations.test_import_cli  s    
 011 	-Q!!!!Z^,,,	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	Y%7888	NN%%G 	
 	
 	
 	
 	
s   AA	A	c                     t          j        t          j        ddgd          }|                     d|j                   dS )zB
        As of v4.17.0, the jsonschema CLI is deprecated.
        z-mr   T)capture_outputs!   The jsonschema CLI is deprecated N)
subprocessrunsys
executableassertInstderr)r   processs     r   test_clizTestDeprecations.test_cli  sH    
 .^T<0
 
 
 	:GNKKKKKrC   N)r?   r@   rA   r   r   r!   r&   r-   r6   r:   rL   rS   re   rk   ru   rB   rC   r   r   r   	   s        
 
 

 
 
 
 
 
"
 
 
"
 
 
"
 
 
$
 
 
$  2
 
 
 a< a< a<F
 
 
 	L 	L 	L 	L 	LrC   r   )	unittestr   rh   rn   rp   r   r   r   r   rB   rC   r   <module>rw      s                  



 0 0 0 0 0 0 0 0\L \L \L \L \Lx \L \L \L \L \LrC   