%PDF- %PDF-
Direktori : /opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/ |
Current File : //opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyo |
� ���Xc @ s� d d l Z d d l m Z m Z d d l m Z d d l m Z m Z d e j f d � � YZ d e j f d � � YZ d e j f d � � YZ d e j f d � � YZ d S( i����N( t Draft4Validatort exceptions( t PY3( t mockt unittestt TestBestMatchc B sY e Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z RS( c C s\ t | � } t j | � } t j t | � � } d } | j | | d | j | | � �| S( Ns: Didn't return a consistent best match! Got: {0} Then: {1}t msg( t listR t best_matcht reversedt assertEqualt format( t selft errorst bestt reversed_bestR ( ( sQ /opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyR s c C ss t i i i d d 6i i d d 6d 6d 6d 6d 6� } | j | j i i g d 6d 6� � } | j | j d � d S( Ni t minPropertiest objectt typet bart propertiest foo( R R t iter_errorsR t validator( R R R ( ( sQ /opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyt( test_shallower_errors_are_better_matches s #&c C sx t i d d 6i d d 6i d d 6g d 6i d d 6i d d 6g d 6� } | j | j i � � } | j | j d � d S( so A property you *must* match is probably better than one you have to match a part of. i R t stringR t numbert anyOft oneOfN( R R R R R ( R R R ( ( sQ /opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyt% test_oneOf_and_anyOf_are_weak_matches! s !c C s� t i i i i d d 6i i i d d 6d 6d 6g d 6d 6d 6� } | j | j i i d d 6d 6� � } | j | j d � d S( sM If the most relevant error is an anyOf, then we traverse its context and select the otherwise *least* relevant error, since in this case that means the most specific, deep, error inside the instance. I.e. since only one of the schemas must match, we look for the most relevant one. R R t arrayR R R R i N( R R R R t validator_value( R R R ( ( sQ /opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyt8 test_if_the_most_relevant_error_is_anyOf_it_is_traversed2 s -&c C s� t i i i i d d 6i i i d d 6d 6d 6g d 6d 6d 6� } | j | j i i d d 6d 6� � } | j | j d � d S( sM If the most relevant error is an oneOf, then we traverse its context and select the otherwise *least* relevant error, since in this case that means the most specific, deep, error inside the instance. I.e. since only one of the schemas must match, we look for the most relevant one. R R R R R R R i N( R R R R R ( R R R ( ( sQ /opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyt8 test_if_the_most_relevant_error_is_oneOf_it_is_traversedL s -&c C s� t i i i i d d 6i i i d d 6d 6d 6g d 6d 6d 6� } | j | j i i d d 6d 6� � } | j | j d � d S( s� Now, if the error is allOf, we traverse but select the *most* relevant error from the context, because all schemas here must match anyways. R R R R R t allOfR i N( R R R R R ( R R R ( ( sQ /opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyt8 test_if_the_most_relevant_error_is_allOf_it_is_traversedf s -&c C s� t i i i i d d 6i i d d 6i i i d d 6d 6d 6g d 6g d 6d 6d 6� } | j | j i i d d 6d 6� � } | j | j d � d S( NR R R R R R R i ( R R R R R ( R R R ( ( sQ /opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyt test_nested_context_for_oneOf| s . &c C sN t i d d 6� } | j i � \ } | j t j | j i � � j d � d S( Ni R ( R R R R R R ( R R t error( ( sQ /opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyt test_one_error� s c C s/ t i � } | j t j | j i � � � d S( N( R t assertIsNoneR R R ( R R ( ( sQ /opt/alt/python27/lib/python2.7/site-packages/jsonschema/tests/test_exceptions.pyt test_no_errors� s ( t __name__t __module__R R R R R! R# R$ R&