
    "Kb                          d Z ddlmZ ddlZ	 ddlmZ  G d dej                        Ze	dk(  r ej                          yy# e$ r	 ddlmZ Y :w xY w)z& Unit tests for the easy_xml.py file.     N)StringIOc                   0    e Zd Zd Zd Zd Zd Zd Zd Zy)TestSequenceFunctionsc                 "    t               | _        y )N)r   stderrselfs    3/usr/lib/python3/dist-packages/gyp/easy_xml_test.pysetUpzTestSequenceFunctions.setUp   s    *DK    c                     | j                  t        j                  dg      d       | j                  t        j                  dgd      d       y )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   s    r
   test_EasyXml_simplez)TestSequenceFunctions.test_EasyXml_simple   sH    F8$57 	F8n=<>r   c                 X    | j                  t        j                  ddddg      d       y )Ntest2value1value2)abzD<?xml version="1.0" encoding="utf-8"?><test2 a="value1" b="value2"/>r   r   s    r
   #test_EasyXml_simple_with_attributesz9TestSequenceFunctions.test_EasyXml_simple_with_attributes   s,    G8(%CDELNr   c                     d}d}|j                  dd      }| j                  t        j                  dd|i|g      d|d|d	       y )
Nz<test>'"&
fooz%&lt;test&gt;'&quot;&#xD;&amp;&#xA;foo'z&apos;test3r   z0<?xml version="1.0" encoding="utf-8"?><test3 a="z">z</test3>)replacer   r   r   )r	   original	convertedconverted_aposs       r
   test_EasyXml_escapingz+TestSequenceFunctions.test_EasyXml_escaping$   sO    "H8I&&sH5NGc8_h?@."#r   c                 d    | j                  t        j                  ddddggdgggd      d       y )	Nr   GrandParentParent1ChildParent2T)prettyz<?xml version="1.0" encoding="utf-8"?>
<test3>
  <GrandParent>
    <Parent1>
      <Child/>
    </Parent1>
    <Parent2/>
  </GrandParent>
</test3>
r   r   s    r
   test_EasyXml_prettyz)TestSequenceFunctions.test_EasyXml_pretty-   sL    	 k	 	r   c           
          d}t        j                  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      }| j                  ||       y )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xmls      r
   test_EasyXml_complexz*TestSequenceFunctions.test_EasyXml_complexD   s     " 

	Wi0DE$23
 i!HI
JI%' -0Y'		
C 	S&!r   N)	__name__
__module____qualname__r   r   r   r#   r*   r>    r   r
   r   r      s!    >N
#.""r   r   __main__)__doc__gyp.easy_xmlr   unittestr   ImportErrorioTestCaser   r?   mainrB   r   r
   <module>rK      s\    -  
U"H-- U"p z(--/ y  s   A AA