
    i                         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 Z	ej                  j                  dd      d        Zd	 Zed
k(  r e	         e         e        yy)    )BytesION)Unpackerpackb	OutOfDataExtTypec                     t        t        g d            } t        |       }|j                         dk(  sJ |j	                         dk(  sJ |j	                         dk(  sJ |j	                         dk(  sJ |j	                         dk(  sJ t        j                  t              5  |j	                          d d d        y # 1 sw Y   y xY w)N)            r   r	   r
   r   )r   r   r   read_array_headerunpackpytestraisesr   )funpackers     p/var/www/vps2.regionflexible.com/Desarrollo/venv/lib/python3.12/site-packages/srsly/tests/msgpack/test_unpack.py"test_unpack_array_header_from_filer      s    l#$A{H%%'1,,,??!!!??!!!??!!!??!!!	y	!   s   $B>>Cz'not hasattr(sys, 'getrefcount') == Truez-sys.getrefcount() is needed to pass this test)reasonc                     g fd} t        j                  |       }t        | |       }t        j                  |       |dz   k\  sJ |j                  t	        i g             |j                  t	        i g             |j                         i gk(  sJ |j                         i gk(  sJ i i gi i ggk(  sJ ~t        j                  |       |k(  sJ y )Nc                 *    j                  |        | S )N)append)xresults    r   hookz'test_unpacker_hook_refcnt.<locals>.hook   s    a    )object_hook	list_hookr
   )sysgetrefcountr   feedr   r   )r   basecntupr   s      @r   test_unpacker_hook_refcntr$      s    
 F ood#G	dd	3B??4 GaK///GGE2$KGGE2$K99;2$99;2$b2$RD))))
??4 G+++r   c            	          G fddt                       } | j                  t        ddi             | j                         ddik(  sJ | j                  t        dt	        dd      i             | j                         ddik(  sJ | j                  t        dt	        dd      i             | j                         dt	        dd      ik(  sJ y )	Nc                   (     e Zd Z fdZd Z xZS )*test_unpacker_ext_hook.<locals>.MyUnpackerc                 <    t         |   | j                  d       y )NF)ext_hookraw)super__init___hook)self
MyUnpacker	__class__s    r   r,   z3test_unpacker_ext_hook.<locals>.MyUnpacker.__init__1   s    *d,djje,Lr   c                 :    |dk(  rt        |      S t        ||      S )Nr	   )intr   )r.   codedatas      r   r-   z0test_unpacker_ext_hook.<locals>.MyUnpacker._hook4   s     qy4y tT**r   )__name__
__module____qualname__r,   r-   __classcell__)r0   r/   s   @r   r/   r'   0   s    	M	+r   r/   ar	   s   123{   r
   s   321)r   r!   r   r   r   )r   r/   s    @r   test_unpacker_ext_hookr;   /   s    +X + |HMM%a/"??a(((MM%ga0123??c
***MM%ga0123??ga&8 9999r   __main__)ior   r   r   srsly.msgpackr   r   r   r   r   markskipifr$   r;   r5    r   r   <module>rB      sm     
  = =	 -:  ,	,0:( z&( r   