Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/third_party/python/gyp/pylib/gyp/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 3 kB image not shown  

Quelle  easy_xml_test.py   Sprache: Python

 
#!/usr/bin/env python

# 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 StringIO 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']),
      '')

    self.assertEqual(
      easy_xml.XmlToString(['test'], encoding='Windows-1252'),
      '')

  def test_EasyXml_simple_with_attributes(self):
    self.assertEqual(
      easy_xml.XmlToString(['test2', {'a''value1''b''value2'}]),
      '')

  def test_EasyXml_escaping(self):
    original = '\'"\r&\nfoo'
    converted = '<test>\'"&#xD;& foo'
    converted_apos = converted.replace("'"''')
    self.assertEqual(
      easy_xml.XmlToString(['test3', {'a': original}, original]),
      '%s' %
      (converted, converted_apos))

  def test_EasyXml_pretty(self):
    self.assertEqual(
      easy_xml.XmlToString(
          ['test3',
            ['GrandParent',
              ['Parent1',
                ['Child']
              ],
              ['Parent2']
            ]
          ],
          pretty=True),
      '\n'
      '\n'
      ' \n'
      ' \n'
      ' \n'
      ' \n'
      ' \n'
      ' \n'
      '\n')


  def test_EasyXml_complex(self):
    # We want to create:
    target = (
      ''
      ''
        ''
          '{D2250C20-3A94-4FB9-AF73-11BC5B73884B}'
          'Win32Proj'
          'automated_ui_tests'
        ''
        ''
        '
            'Condition="\'$(Configuration)|$(Platform)\'=='
                       '\'Debug|Win32\'" Label="Configuration">'
          'Application'
          'Unicode'
          'SpectreLoadCF'
        '
'

      '')

    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'],
            ['SpectreMitigation''SpectreLoadCF']
          ]
        ])
    self.assertEqual(xml, target)


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

Messung V0.5
C=94 H=78 G=86

¤ Dauer der Verarbeitung: 0.11 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.