o
    p.a                      @   sr   d Z ddlmZ ddlZzddlmZ W n ey#   ddlmZ Y nw G dd dejZe	dkr7e
  dS dS )z& Unit tests for the easy_xml.py file.     N)StringIOc                   @   s<   e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd ZdS )TestSequenceFunctionsc                 C   s   t  | _d S )N)r   stderrself r   3/usr/lib/python3/dist-packages/gyp/easy_xml_test.pysetUp   s   zTestSequenceFunctions.setUpc                 C   s0   |  tdgd |  tjdgddd d S )Ntestz-<?xml version="1.0" encoding="utf-8"?><test/>zWindows-1252)encodingz4<?xml version="1.0" encoding="Windows-1252"?><test/>assertEqualeasy_xmlXmlToStringr   r   r   r   test_EasyXml_simple   s   
z)TestSequenceFunctions.test_EasyXml_simplec                 C   s    |  tddddgd d S )Ntest2value1value2)abzD<?xml version="1.0" encoding="utf-8"?><test2 a="value1" b="value2"/>r   r   r   r   r   #test_EasyXml_simple_with_attributes   s   z9TestSequenceFunctions.test_EasyXml_simple_with_attributesc                 C   s<   d}d}| dd}| tdd|i|gd||f  d S )Nz<test>'"&
fooz%&lt;test&gt;'&quot;&#xD;&amp;&#xA;foo'z&apos;test3r   z><?xml version="1.0" encoding="utf-8"?><test3 a="%s">%s</test3>)replacer   r   r   )r   original	convertedconverted_aposr   r   r   test_EasyXml_escaping$   s   z+TestSequenceFunctions.test_EasyXml_escapingc                 C   s,   |  tjddddggdgggddd d S )	Nr   GrandParentParent1ChildParent2T)prettyz<?xml version="1.0" encoding="utf-8"?>
<test3>
  <GrandParent>
    <Parent1>
      <Child/>
    </Parent1>
    <Parent2/>
  </GrandParent>
</test3>
r   r   r   r   r   test_EasyXml_pretty-   s   
z)TestSequenceFunctions.test_EasyXml_prettyc              
   C   s^   d}t ddddiddgdd	gd
dggdddigddddddgddggg}| || d S )Na  <?xml version="1.0" encoding="utf-8"?><Project><PropertyGroup Label="Globals"><ProjectGuid>{D2250C20-3A94-4FB9-AF73-11BC5B73884B}</ProjectGuid><Keyword>Win32Proj</Keyword><RootNamespace>automated_ui_tests</RootNamespace></PropertyGroup><Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/><PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"><ConfigurationType>Application</ConfigurationType><CharacterSet>Unicode</CharacterSet></PropertyGroup></Project>ProjectPropertyGroupLabelGlobalsProjectGuidz&{D2250C20-3A94-4FB9-AF73-11BC5B73884B}Keyword	Win32ProjRootNamespaceautomated_ui_testsImportz$$(VCTargetsPath)\Microsoft.Cpp.propsz-'$(Configuration)|$(Platform)'=='Debug|Win32'Configuration)	Conditionr&   ConfigurationTypeApplicationCharacterSetUnicode)r   r   r   )r   targetxmlr   r   r   test_EasyXml_complexD   s(   
z*TestSequenceFunctions.test_EasyXml_complexN)	__name__
__module____qualname__r	   r   r   r   r#   r6   r   r   r   r   r      s    		r   __main__)__doc__gyp.easy_xmlr   unittestr   ImportErrorioTestCaser   r7   mainr   r   r   r   <module>   s   X