HEX
Server: Apache
System: Linux 185.122.168.184.host.secureserver.net 5.14.0-570.60.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Nov 5 05:00:59 EST 2025 x86_64
User: barbeatleanalyti (1024)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //var/opt/nydus/ops/referencing/tests/__pycache__/test_retrieval.cpython-39.pyc
a

�,�h��@sZddlmZddlZddlZddlmZmZmZddlm	Z	ddl
mZGdd�d�ZdS)�)�	lru_cacheN)�Registry�Resource�
exceptions)�DRAFT202012)�to_cached_resourcec@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�TestToCachedResourcecspddi}t�|�g�t��fdd��}t|d�}t�|�}|�d�}|j|ksRJ�|�d�}|j|juslJ�dS)N�$schema�,https://json-schema.org/draft/2020-12/schemacs���S�N��pop��uri��stack��Q/opt/nydus/tmp/pip-target-wkfpz8uv/lib/python/referencing/tests/test_retrieval.py�retrieveszITestToCachedResource.test_it_caches_retrieved_resources.<locals>.retrieve�r�urn:example:schema��json�dumpsrrr�
from_contents�get_or_retrieve�value��self�contentsr�registry�expected�gotZagainrrr�"test_it_caches_retrieved_resourcess



z7TestToCachedResource.test_it_caches_retrieved_resourcescs�ddi}t�|�ddd�g�tdd�d��fdd��}t|d	�}t�|�}|�d
�}|j|ksdJ�|�d
�}|j|jus~J�dS)Nr	r
���cSst�|ddd��S)Nr$)r�loads)�srrr�<lambda>#�z9TestToCachedResource.test_custom_loader.<locals>.<lambda>)r%cs���Srrrrrrr#sz9TestToCachedResource.test_custom_loader.<locals>.retrieverrrrrrr�test_custom_loaders



z'TestToCachedResource.test_custom_loadercsri}t�|�g�ttjd��fdd��}t|d�}t�|�}|�d�}|j|ksTJ�|�d�}|j|jusnJ�dS)N)rcs���Srrrrrrr6sz@TestToCachedResource.test_custom_from_contents.<locals>.retrieverr)rrrrZcreate_resourcerrrrrrr�test_custom_from_contents2s




z.TestToCachedResource.test_custom_from_contentscs~ddi}t|dd�t|dd�t|dd�d��dd	����D�}ttdd
�d��fdd
��}t|d�}|�d�}|j|dks�J�|�d�j|jus�J�|�d�j|jus�J�|�d�}|j|dks�J�|�d�j|jus�J�|�d�j|jus�J�|�d�}|j|dk�sJ�|�d�j|ju�s*J�|�d�j|ju�sBJ�t�t	j
��|�d�Wd�n1�sp0YdS)Nr	r
�)Zfoo��)�
urn:example:1�
urn:example:2�
urn:example:3cSsi|]\}}|t�|��qSr)rr)�.0rrrrr�
<dictcomp>Ms�z:TestToCachedResource.test_custom_cache.<locals>.<dictcomp>)�maxsize)�cachecst���|��Sr)rrr
r��mappingrrrRsz8TestToCachedResource.test_custom_cache.<locals>.retrieverr.r/r0)�dict�itemsrrrrr�pytestZraisesrZ
Unretrievable)rZschema�	resourcesrr r"rr5r�test_custom_cacheEs2


��



z&TestToCachedResource.test_custom_cacheN)�__name__�
__module__�__qualname__r#r)r*r;rrrrrsr)
�	functoolsrrr9ZreferencingrrrZreferencing.jsonschemarZreferencing.retrievalrrrrrr�<module>s