
    @wg                     |    d dl Z d dlmZ d dlZd dlZd dlZd dlmZ d dlm	Z	  ej                  dd      Zd Zd	 Zy)
    N)mock)
PyPNGImage)UNICODE_TEXTpngzpng is not installed)reasonc                  r   t        j                         } | j                  t               | j	                  t
              }t        |j                         t        j                        sJ t        |j                  |j                  |j                         |j                  t        j                                 y )Nimage_factory)qrcodeQRCodeadd_datar   
make_imager   
isinstance	get_imager   Writerprintwidthbox_sizebordersaveioBytesIO)qrimgs     U/var/www/horilla/myenv/lib/python3.12/site-packages/qrcode/tests/test_qrcode_pypng.pytest_render_pypngr      sm    	BKK
--j-
1Ccmmoszz222	#))S\\3::.HHRZZ\    c                     t        j                         } | j                  t               | j	                  t
              }t        |j                         t        j                        sJ t        j                         }t        j                  d|d      5  |j                  d       d d d        |j                  dd        |dd      j                  j!                          y # 1 sw Y   =xY w)Nr	   zqrcode.image.pure.openT)createztest_file.pngwb)r   r   r   r   r   r   r   r   r   r   r   	mock_openpatchr   assert_called_once_withwriteassert_called)r   r   r!   s      r   test_render_pypng_to_strr&      s    	BKK
--j-
1Ccmmoszz222 I	,i	E "!"%%ot<ot$**88:" "s   C$$C-)r   unittestr   pytestr   qrcode.utilqrcode.image.purer   qrcode.tests.constsr   importorskipr   r   r&    r   r   <module>r.      s;    	     ( ,f%(>?
;r   