
    h                         S SK Jr  S SKrS SKrS SKJrJrJrJr  S r	\R                  R                  SSS9S 5       rS	 r\S
:X  a  \	" 5         \" 5         \" 5         gg)    )BytesION)Unpackerpackb	OutOfDataExtTypec                     [        [        / SQ5      5      n [        U 5      nUR                  5       S:X  d   eUR	                  5       S:X  d   eUR	                  5       S:X  d   eUR	                  5       S:X  d   eUR	                  5       S:X  d   e[
        R                  " [        5         UR	                  5         S S S 5        g ! , (       d  f       g = f)N)            r   r	   r
   r   )r   r   r   read_array_headerunpackpytestraisesr   )funpackers     Y/home/james-whalen/.local/lib/python3.13/site-packages/srsly/tests/msgpack/test_unpack.py"test_unpack_array_header_from_filer      s    l#$A{H%%'1,,,??!!!??!!!??!!!??!!!	y	! 
"	!	!s   *C
Cz'not hasattr(sys, 'getrefcount') == Truez-sys.getrefcount() is needed to pass this test)reasonc                    ^ / mU4S jn [         R                  " U 5      n[        X S9n[         R                  " U 5      US-   :  d   eUR                  [	        0 /5      5        UR                  [	        0 /5      5        UR                  5       0 /:X  d   eUR                  5       0 /:X  d   eT0 0 /0 0 //:X  d   eA[         R                  " U 5      U:X  d   eg )Nc                 *   > TR                  U 5        U $ )N)append)xresults    r   hook'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	d	3B??4 GaK///GGE2$KGGE2$K99;2$99;2$b2$RD))))
??4 G+++r   c            	        ^  " U4S jS[         5      mT" 5       n U R                  [        SS05      5        U R                  5       SS0:X  d   eU R                  [        S[	        SS5      05      5        U R                  5       SS0:X  d   eU R                  [        S[	        SS5      05      5        U R                  5       S[	        SS5      0:X  d   eg )	Nc                   2   >^  \ rS rSrUU 4S jrS rSrU =r$ )*test_unpacker_ext_hook.<locals>.MyUnpacker0   c                 6   > [         TU ]  U R                  SS9  g )NF)ext_hookraw)super__init___hook)self
MyUnpacker	__class__s    r   r.   3test_unpacker_ext_hook.<locals>.MyUnpacker.__init__1   s    *d,djje,Lr   c                 :    US:X  a  [        U5      $ [        X5      $ )Nr	   )intr   )r0   codedatas      r   r/   0test_unpacker_ext_hook.<locals>.MyUnpacker._hook4   s    qy4y t**r    )__name__
__module____qualname____firstlineno__r.   r/   __static_attributes____classcell__)r2   r1   s   @r   r1   r(   0   s    	M	+ 	+r   r1   ar	   s   123{   r
   s   321)r   r"   r   r   r   )r   r1   s    @r   test_unpacker_ext_hookrB   /   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%   rB   r:   r9   r   r   <module>rH      sm     
  = =	 -:  ,	,0:( z&( r   