o
    
i                     @   s~   d dl mZ d dlZd dlZd dlmZmZmZmZ dd Z	ej
jdddd	d
 Zdd Zedkr=e	  e  e  dS dS )    )BytesION)Unpackerpackb	OutOfDataExtTypec                  C   s   t tg d} t| }| dksJ | dksJ | dks$J | dks,J | dks4J tt |  W d    d S 1 sIw   Y  d S )N)            r
   r   r   r	   )r   r   r   read_array_headerunpackpytestraisesr   )funpacker r   S/home/ubuntu/.local/lib/python3.10/site-packages/srsly/tests/msgpack/test_unpack.py"test_unpack_array_header_from_file   s   
"r   z'not hasattr(sys, 'getrefcount') == Truez-sys.getrefcount() is needed to pass this test)reasonc                     s   g   fdd} t | }t| | d}t | |d ksJ |ti g |ti g | i gks7J | i gks@J  i i gi i ggksLJ ~t | |ksVJ d S )Nc                    s     |  | S )N)append)xresultr   r   hook   s   
z'test_unpacker_hook_refcnt.<locals>.hook)object_hook	list_hookr   )sysgetrefcountr   feedr   r   )r   basecntupr   r   r   test_unpacker_hook_refcnt   s   
r!   c                     s   G  fdddt    } | tddi |  ddiks J | tdtddi |  ddiks6J | tdtddi |  dtddiksOJ d S )	Nc                       s&   e Zd Z fddZdd Z  ZS )z*test_unpacker_ext_hook.<locals>.MyUnpackerc                    s   t  | j| jdd d S )NF)ext_hookraw)super__init___hook)self)
MyUnpacker	__class__r   r   r%   1   s   z3test_unpacker_ext_hook.<locals>.MyUnpacker.__init__c                 S   s   |dkrt |S t||S )Nr   )intr   )r'   codedatar   r   r   r&   4   s   
z0test_unpacker_ext_hook.<locals>.MyUnpacker._hook)__name__
__module____qualname__r%   r&   __classcell__r   r(   )r)   r   r(   0   s    r(   ar   s   123{   r   s   321)r   r   r   r   r   )r   r   r1   r   test_unpacker_ext_hook/   s   
r4   __main__)ior   r   r   srsly.msgpackr   r   r   r   r   markskipifr!   r4   r-   r   r   r   r   <module>   s     

