Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib64/python3.5/test/test_tools/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/test/test_tools/__pycache__/test_i18n.cpython-35.opt-1.pyc



��Yf
�@sxdZddlZddlZddlmZddlmZmZddlm	Z	e�Gdd�dej
�ZdS)z%Tests to cover the Tools/i18n package�N)�assert_python_ok)�skip_if_missing�toolsdir)�temp_cwdc@sReZdZdZejjedd�Zdd�Z	dd�Z
dd	�Zd
S)�Test_pygettextzTests for the pygettext.py toolZi18nzpygettext.pycCsti}xg|jd�D]V}|s|jd�r5q|jd�}|jdd�\}}|j�||<qW|S)	z: utility: return the header of a .po file as a dictionary �
�#�msgid�msgstr�"�:�)rr	r
)�split�
startswith�strip)�self�dataZheaders�line�key�val�r�>/opt/alt/python35/lib64/python3.5/test/test_tools/test_i18n.py�
get_headerszTest_pygettext.get_headercCs�td���}t|j�td��}|j�}WdQRX|j|�}|jd|�|jd|�|jd|�|jd|�|jd|�|jd|�|jd	|�|jd
|�|jd|�WdQRXdS)z�Make sure the required fields are in the header, according to:
           http://www.gnu.org/software/gettext/manual/gettext.html#Header-Entry
        Nzmessages.potzProject-Id-VersionzPOT-Creation-DatezPO-Revision-DatezLast-Translatorz
Language-TeamzMIME-VersionzContent-TypezContent-Transfer-EncodingzGenerated-By)rr�script�open�readrZassertIn)r�cwd�fpr�headerrrr�test_headers
zTest_pygettext.test_headercCs�ddlm}td���}t|j�td��}|j�}WdQRX|j|�}|d}|jd�r�|dtd��}|j	|d�WdQRXdS)z; Match the date format from xgettext for POT-Creation-Date r)�datetimeNzmessages.potzPOT-Creation-Datez\nz%Y-%m-%d %H:%M%z)
r rrrrrr�endswith�lenZstrptime)rr rrrrZcreationDaterrr�test_POT_Creation_Date9s

z%Test_pygettext.test_POT_Creation_DateN)�__name__�
__module__�__qualname__�__doc__�os�path�joinrrrrr#rrrrrs
r)r'r(ZunittestZtest.support.script_helperrZtest.test_toolsrrZtest.supportrZTestCaserrrrr�<module>s