
    `d=                     2    d dl mZ d dlmZ  G d de      Zy)    )TestCase)
validatorsc                   6    e Zd Zd Zd Zd Zd Zd Zd Zd Z	y)	TestDeprecationsc                 
   | j                  t              5 }ddlm} ddd       | j	                  j
                  t               | j                  t        |j                        j                  d             y# 1 sw Y   ]xY w)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      D/usr/lib/python3/dist-packages/jsonschema/tests/test_deprecations.pytest_versionzTestDeprecations.test_version   sh    
 01 	/Q.	/ 	X.		N%%@	
		/ 	/   A99Bc                 
   | j                  t              5 }ddlm} ddd       | j	                  j
                  t               | j                  t        |j                        j                  d             y# 1 sw Y   ]xY w)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   sh     01 	8Q7	8 	X.		N%%N	
		8 	8r   c                 ^   | j                  t              5 }t        j                  }ddd       | j                  t        j                         | j                  j
                  t               | j                  t        |j                        j                  d             y# 1 sw Y   }xY w)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 	*Q))E	*
 6 67X.		N%%J	
	* 	*   B##B,c                 ^   | j                  t              5 }t        j                  }ddd       | j	                  t        j
                         | j	                  j                  t               | j                  t        |j                        j                  d             y# 1 sw Y   }xY w)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_schemas7   s     01 	,Q++E	,
 8 89X.		N%%L	
	, 	,r!   c                    t         j                  j                  i       }| j                  t              5 }|j                  d      5  	 ddd       ddd       | j                  j                  t               | j                  t        |j                        j                  d             y# 1 sw Y   exY w# 1 sw Y   ixY w)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_scopeH   s    
 ))55b901 	Q""5) 	 	X.		N%%@	
	 	 	s#   B9B-	B9-B6	2B99Cc                 r   t        j                  i       }| j                  t              5 }|j	                  dddi      }ddd       | j                         | j                  j                  t               | j                  t        |j                        j                  d             y# 1 sw Y   nxY w)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_argumentsY   s     ..r2	01 	CQ''/ABF	C 	 X.		N%%G	
	C 	Cs   B--B6c                    t        j                  i       }| j                  t              5 }|j	                  dddi      \  }ddd       | j                  j                  d       | j                  j                  t               | j                  t        |j                        j                  d             y# 1 sw Y   yxY w)z}
        As of v4.0.0, calling iter_errors with two arguments (to provide a
        different schema) is deprecated.
        r'   r.   r/   Nz8Passing a schema to Validator.iter_errors is deprecated )r   r0   r	   r
   iter_errorsr   r3   r   r   r   r   r   r   )r   r3   r   errors       r   (test_Validator_iter_errors_two_argumentsz9TestDeprecations.test_Validator_iter_errors_two_argumentsk   s     ..r2	01 	FQ**5682DEFE	F 	&1X.		N%%J	
	F 	Fs   B::CN)
__name__
__module____qualname__r   r   r    r%   r,   r5   r9        r   r   r      s%    

 
"
"
"
$
r>   r   N)unittestr   r   r   r   r=   r>   r   <module>r@      s     !u
x u
r>   