$33 GRAYBYTE WORDPRESS FILE MANAGER $41

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 104.21.43.35 | ADMIN IP 216.73.216.157
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/

HOME
Current File : /usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp//easy_xml_test.py
#! /usr/bin/python2

# Copyright (c) 2011 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

""" Unit tests for the easy_xml.py file. """

import gyp.easy_xml as easy_xml
import unittest
try:
  from cStringIO import StringIO
except ImportError:
  from io import StringIO


class TestSequenceFunctions(unittest.TestCase):

  def setUp(self):
    self.stderr = StringIO()

  def test_EasyXml_simple(self):
    self.assertEqual(
      easy_xml.XmlToString(['test']),
      '<?xml version="1.0" encoding="utf-8"?><test/>')

    self.assertEqual(
      easy_xml.XmlToString(['test'], encoding='Windows-1252'),
      '<?xml version="1.0" encoding="Windows-1252"?><test/>')

  def test_EasyXml_simple_with_attributes(self):
    self.assertEqual(
      easy_xml.XmlToString(['test2', {'a': 'value1', 'b': 'value2'}]),
      '<?xml version="1.0" encoding="utf-8"?><test2 a="value1" b="value2"/>')

  def test_EasyXml_escaping(self):
    original = '<test>\'"\r&\nfoo'
    converted = '&lt;test&gt;\'&quot;&#xD;&amp;&#xA;foo'
    converted_apos = converted.replace("'", '&apos;')
    self.assertEqual(
      easy_xml.XmlToString(['test3', {'a': original}, original]),
      '<?xml version="1.0" encoding="utf-8"?><test3 a="%s">%s</test3>' %
      (converted, converted_apos))

  def test_EasyXml_pretty(self):
    self.assertEqual(
      easy_xml.XmlToString(
          ['test3',
            ['GrandParent',
              ['Parent1',
                ['Child']
              ],
              ['Parent2']
            ]
          ],
          pretty=True),
      '<?xml version="1.0" encoding="utf-8"?>\n'
      '<test3>\n'
      '  <GrandParent>\n'
      '    <Parent1>\n'
      '      <Child/>\n'
      '    </Parent1>\n'
      '    <Parent2/>\n'
      '  </GrandParent>\n'
      '</test3>\n')


  def test_EasyXml_complex(self):
    # We want to create:
    target = (
      '<?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>')

    xml = easy_xml.XmlToString(
        ['Project',
          ['PropertyGroup', {'Label': 'Globals'},
            ['ProjectGuid', '{D2250C20-3A94-4FB9-AF73-11BC5B73884B}'],
            ['Keyword', 'Win32Proj'],
            ['RootNamespace', 'automated_ui_tests']
          ],
          ['Import', {'Project': '$(VCTargetsPath)\\Microsoft.Cpp.props'}],
          ['PropertyGroup',
            {'Condition': "'$(Configuration)|$(Platform)'=='Debug|Win32'",
             'Label': 'Configuration'},
            ['ConfigurationType', 'Application'],
            ['CharacterSet', 'Unicode']
          ]
        ])
    self.assertEqual(xml, target)


if __name__ == '__main__':
  unittest.main()


Current_dir [ NOT WRITEABLE ] Document_root [ NOT WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
1 Jan 1970 12.00 AM
root / root
0
generator
--
3 Mar 2024 10.36 PM
root / root
0755
MSVSNew.py
11.656 KB
10 Mar 2021 2.36 PM
root / root
0644
MSVSProject.py
6.237 KB
10 Mar 2021 2.36 PM
root / root
0644
MSVSSettings.py
44.11 KB
10 Mar 2021 2.36 PM
root / root
0644
MSVSSettings_test.py
64.562 KB
10 Mar 2021 2.36 PM
root / root
0644
MSVSToolFile.py
1.762 KB
10 Mar 2021 2.36 PM
root / root
0644
MSVSUserFile.py
4.967 KB
10 Mar 2021 2.36 PM
root / root
0644
MSVSUtil.py
9.31 KB
10 Mar 2021 2.36 PM
root / root
0644
MSVSVersion.py
17.024 KB
10 Mar 2021 2.36 PM
root / root
0644
__init__.py
21.868 KB
10 Mar 2021 2.36 PM
root / root
0644
common.py
20.579 KB
10 Mar 2021 2.36 PM
root / root
0644
common_test.py
1.918 KB
10 Mar 2021 2.36 PM
root / root
0644
easy_xml.py
4.873 KB
10 Mar 2021 2.36 PM
root / root
0644
easy_xml_test.py
3.249 KB
10 Mar 2021 2.36 PM
root / root
0644
flock_tool.py
1.706 KB
10 Mar 2021 2.36 PM
root / root
0644
input.py
113.647 KB
10 Mar 2021 2.36 PM
root / root
0644
input_test.py
3.11 KB
10 Mar 2021 2.36 PM
root / root
0644
mac_tool.py
22.892 KB
10 Mar 2021 2.36 PM
root / root
0644
msvs_emulation.py
46.759 KB
10 Mar 2021 2.36 PM
root / root
0644
ninja_syntax.py
5.406 KB
10 Mar 2021 2.36 PM
root / root
0644
simple_copy.py
1.302 KB
10 Mar 2021 2.36 PM
root / root
0644
win_tool.py
12.723 KB
10 Mar 2021 2.36 PM
root / root
0644
xcode_emulation.py
64.854 KB
10 Mar 2021 2.36 PM
root / root
0644
xcode_ninja.py
10.32 KB
10 Mar 2021 2.36 PM
root / root
0644
xcodeproj_file.py
117.659 KB
10 Mar 2021 2.36 PM
root / root
0644
xml_fix.py
2.123 KB
10 Mar 2021 2.36 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF