
    Dh                     J    d dl Z d dlZd dlZdZ G d dej                        Zy)    NzHello world.
c                   *    e Zd Zd Zd Zd Zd Zd Zy)BytesIOTestc                 D   | j                  t        d      5  t        j                         }t        j                  |d      5 }|j                  t               d d d        |j                         j                  d       d d d        y # 1 sw Y   1xY w# 1 sw Y   y xY wNzI/O operation on closed file.msgutf-8encoding)	assertRaises
ValueErrorioBytesIOTextIOWrapperwriteTEXTgetvaluedecodeselfbytesiotextouts      t/var/www/fastuser/data/www/generator.snapmosaic.io/flask_app/venv/lib/python3.12/site-packages/tests/bytesio_test.py$test_value_not_available_after_closez0BytesIOTest.test_value_not_available_after_close	   s    z/NO 	/jjlG!!'G< $d#$%%g.		/ 	/$ $	/ 	/s#   ,BB
'B
B	BBc                    t        j                         }t        j                  |d      5 }|j                  t               |j                          |j                         }d d d        t        j                  t        j                              5 }| j                  t        |j                                d d d        y # 1 sw Y   _xY w# 1 sw Y   y xY w)Nr	   r
   )	r   r   r   r   r   flushr   assertEqualread)r   r   r   bytestextins        r   2test_getvalue_before_close_sometimes_is_sufficientz>BytesIOTest.test_getvalue_before_close_sometimes_is_sufficient   s     **,g8 	'GMM$MMO$$&E	' bjj/0 	2FT6;;=1	2 	2		' 	'	2 	2s   6C %C C	Cc                    t               }t        j                  t        j                  |      d      5 }|j	                  t
               d d d        | j                  d|j                  d             y # 1 sw Y   +xY w)Nr	   r
    )	bytearrayr   r   r   r   r   r   r   )r   bytesbufr   s      r   ,test_with_underlying_bytearray_does_not_workz8BytesIOTest.test_with_underlying_bytearray_does_not_work   s^    ;bjj2WE 	 MM$	 X__W56	  	 s   A55A>c                 &   | j                  t        d      5  t        j                         }t        j                  |d      5 }|j                  t               d d d        |j                          d d d        y # 1 sw Y   "xY w# 1 sw Y   y xY wr   )r   r   r   r   r   r   r   	getbufferr   s      r   test_with_buffer_does_not_workz*BytesIOTest.test_with_buffer_does_not_work!   sz    z/NO 	 jjlG!!'G< $d#$		  	 $ $	  	 s#   ,BA;B;B	 BBc                    | j                  t        d      5  t        j                         }t	        j
                  |dd      5 }|j                  t               |j                          |j                         }d d d        t	        j
                  t        j                        d      5 }| j                  t        |j                                d d d        d d d        y # 1 sw Y   ixY w# 1 sw Y   xY w# 1 sw Y   y xY w)NzACompressed file ended before the end-of-stream marker was reachedr   wtr	   )moder   rt)r,   )r   EOFErrorr   r   gzipopenr   r   r   r   r   r   )r   r   r   gzipped_bytesr    s        r   2test_getvalue_before_close_does_not_work_with_gzipz>BytesIOTest.test_getvalue_before_close_does_not_work_with_gzip(   s    x-pq 	6jjlG7@ 3Gd# ' 0 0 23 2::m44@ 6F  v{{}56	6 	63 36 6	6 	6s;   -C;6C#;2C;-%C/C;#C,	(C;/C8	4C;;DN)__name__
__module____qualname__r   r!   r&   r)   r2        r   r   r      s    /	27 6r7   r   )r/   r   unittestr   TestCaser   r6   r7   r   <module>r:      s%     	 (6(## (6r7   