o
    tBh*                     @   s   d Z ddlZddlZddlmZ ddlmZ ddlmZ ddlmZ ej	
ej	eZej	edZej	edZd	Zd
ZdZdZdZdd ZdS )z7Generates barcodes for visually inspecting the results.    N)get_barcode)get_barcode_class)version)ImageWritertest_outputsz
index.htmlz<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>python-barcode {version} Test</title>
    </head>
    <body>
        <h1>python-barcode {version} Tests</h1>
        {body}
    </body>
</html>
z?<p><h2>{name}</h2><br>
<img src="{filename}" alt="SVG {name}">
zF<h3>As PNG-Image</h3><br>
<img src="{filename}" alt="PNG {name}"></p>
z9<h3>Pillow was not found. No PNG-Image created.</h3></p>
))ean840267708)ean135901234123457)ean1412345678911230)upca36000291453)jan4901234567894)isbn10z3-12-517154-7)isbn13z978-3-16-148410-0)issn1144875X)code39zExample Code 39)pzn487780)code128zExample Code 128 998866)itf12341234c                     s  t jtdd g   fdd}  fdd}ddd	}tD ]w\}}t||}|d
r/d|d< nd|d< |jt jt||d}t	d
|j||  | t j||j td urt|}||t d}ddd}|d
rsd|d< nd|d< |jt jt||d}|t j||j q t qtjtddd}	d }
|	tj
t|
d W d    n1 sw   Y  t	dj
td d S )NT)exist_okc                         tj| |d d S N)filenamename)appendOBJECTSformatxyobjects j/var/www/html/riverr-enterprise-integrations-main/venv/lib/python3.10/site-packages/tests/test_manually.pyr    6      z(test_generating_barcodes.<locals>.appendc                    r   r   )r    IMAGESr"   r#   r&   r(   r)   
append_img9   r*   z,test_generating_barcodes.<locals>.append_imggGz?g      9@)module_widthmodule_heightiFcenter_text)optionszCode: {}, Input: {}, Output: {})writer      )	font_sizetext_distancewzutf-8)encoding
)r   bodyz%
Now open {htmlfile} in your browser.)htmlfile)osmakedirsTESTPATH	TESTCODESr   
startswithsavepathjoinprintr"   r   get_fullcodebasenamer   r   r    NO_PILcodecsopenHTMLFILEwriteHTMLr   )r    r,   r1   codenamecodebcoder   bcodecoptsfobjr(   r&   r)   test_generating_barcodes1   s@   







rT   )__doc__rH   r<   barcoder   r   r   barcode.writerr   rB   dirnameabspath__file__PATHrC   r>   rJ   rL   r!   r+   rG   r?   rT   r(   r(   r(   r)   <module>   s     