⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.12
Server IP:
97.74.87.16
Server:
Linux 16.87.74.97.host.secureserver.net 5.14.0-503.38.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Apr 18 08:52:10 EDT 2025 x86_64
Server Software:
Apache
PHP Version:
8.2.28
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
var
/
opt
/
nydus
/
ops
/
jsonschema
/
tests
/
__pycache__
/
View File Name :
test_exceptions.cpython-39.pyc
a ���g?X � @ s� d dl mZ d dlZd dlmZ d dlmZ G dd� de�ZG dd� de�ZG d d � d e�Z G dd� de�Z G d d� de�ZdS )� )�TestCaseN)� exceptions)�_LATEST_VERSIONc @ s� e Zd Zdd� Zdd� Zdd� Zdd� Zd d � Zdd� Zd d� Z dd� Z dd� Zdd� Zdd� Z dd� Zdd� Zdd� Zdd� Zdd � Zd!d"� Zd#d$� Zd%d&� Zd'd(� Zd)S )*� TestBestMatchc C st t t|��|��}d|� d|�d�}| j||d� t�t|��}t�t|��}| �|� � |� � d|� d|� �� |S )NzNo errors found for z under �!)�msgzNo consistent best match! Got: z Then: ) �listr �iter_errors� assertTruer � best_match�iter�reversed�assertEqualZ _contents)�self�instance�schema�errorsr �bestZ reversed_best� r �Q/opt/nydus/tmp/pip-target-mke_irhy/lib/python/jsonschema/tests/test_exceptions.py� best_match_of s �zTestBestMatch.best_match_ofc C sB ddddddiid�ii}| j ddg ii|d�}| �|jd � d S ) N� properties�foo� �bar�type�object)� minPropertiesr �r r r �r r � validator�r r r r r r �(test_shallower_errors_are_better_matches s ���z6TestBestMatch.test_shallower_errors_are_better_matchesc C sD dddiddigddiddigd�}| j i |d�}| �|jd� dS ) zn A property you *must* match is probably better than one you have to match a part of. r r �string�number)r �anyOf�oneOfr r Nr r! r r r �%test_oneOf_and_anyOf_are_weak_matches$ s �z3TestBestMatch.test_oneOf_and_anyOf_are_weak_matchesc C sL dddddiddddiiigiii}| j dddii|d �}| �|jd� d S )aL 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 r% r r# r �array� r N�r r �validator_valuer! r r r �8test_if_the_most_relevant_error_is_anyOf_it_is_traversed2 s ���� zFTestBestMatch.test_if_the_most_relevant_error_is_anyOf_it_is_traversedc C s: dddiddiddigi}| j g |d�}| �|jd� dS )z� We don't traverse into an anyOf (as above) if all of its context errors seem to be equally "wrong" against the instance. r% r r# �integerr r Nr r! r r r �3test_no_anyOf_traversal_for_equally_relevant_errorsI s ��zATestBestMatch.test_no_anyOf_traversal_for_equally_relevant_errorsc C s. dddigi}| j g |d�}| �|jd� dS )z� We *do* traverse anyOf with a single nested error, even though it is vacuously equally relevant to itself. r% r r# r Nr r! r r r �6test_anyOf_traversal_for_single_equally_relevant_errorY s ��zDTestBestMatch.test_anyOf_traversal_for_single_equally_relevant_errorc C s6 ddddiigi}| j ddg|d�}| �|jd� dS )z| We *do* traverse anyOf with a single subschema that fails multiple times (e.g. on multiple items). r% �items�const�% r) r Nr r! r r r �.test_anyOf_traversal_for_single_sibling_errorsg s ��z<TestBestMatch.test_anyOf_traversal_for_single_sibling_errorsc C s<