From 13ba1a1c6571dad26e3030525556ec4b552b0865 Mon Sep 17 00:00:00 2001 From: Florent Xicluna Date: Sat, 13 Mar 2010 11:18:49 +0000 Subject: Move the xml test data to their own directory. --- Lib/test/samples/simple-ns.xml | 7 --- Lib/test/samples/simple.xml | 6 -- Lib/test/test.xml | 115 ------------------------------------- Lib/test/test.xml.out | 115 ------------------------------------- Lib/test/test_minidom.py | 2 +- Lib/test/test_sax.py | 17 +++--- Lib/test/test_xml_etree.py | 45 ++++++++------- Lib/test/test_xml_etree_c.py | 5 ++ Lib/test/xmltestdata/simple-ns.xml | 7 +++ Lib/test/xmltestdata/simple.xml | 6 ++ Lib/test/xmltestdata/test.xml | 115 +++++++++++++++++++++++++++++++++++++ Lib/test/xmltestdata/test.xml.out | 115 +++++++++++++++++++++++++++++++++++++ Makefile.pre.in | 2 +- Tools/msi/msi.py | 5 +- 14 files changed, 288 insertions(+), 274 deletions(-) delete mode 100644 Lib/test/samples/simple-ns.xml delete mode 100644 Lib/test/samples/simple.xml delete mode 100644 Lib/test/test.xml delete mode 100644 Lib/test/test.xml.out create mode 100644 Lib/test/xmltestdata/simple-ns.xml create mode 100644 Lib/test/xmltestdata/simple.xml create mode 100644 Lib/test/xmltestdata/test.xml create mode 100644 Lib/test/xmltestdata/test.xml.out diff --git a/Lib/test/samples/simple-ns.xml b/Lib/test/samples/simple-ns.xml deleted file mode 100644 index f1f34b2..0000000 --- a/Lib/test/samples/simple-ns.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - text - texttail - - diff --git a/Lib/test/samples/simple.xml b/Lib/test/samples/simple.xml deleted file mode 100644 index b88c2c7..0000000 --- a/Lib/test/samples/simple.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - text - texttail - - diff --git a/Lib/test/test.xml b/Lib/test/test.xml deleted file mode 100644 index 9af92fb..0000000 --- a/Lib/test/test.xml +++ /dev/null @@ -1,115 +0,0 @@ - - -Introduction to XSL -

Introduction to XSL

- - - -
-

Overview -

- - - - - - - -
-

Intro

- - - - - - - -
-

History: XML and SGML

- - - - - - - -
-

History: What are stylesheets?

- - - - - - - -
-

History: FOSI

- - - - - - diff --git a/Lib/test/test.xml.out b/Lib/test/test.xml.out deleted file mode 100644 index d4ab1ab..0000000 --- a/Lib/test/test.xml.out +++ /dev/null @@ -1,115 +0,0 @@ - - -Introduction to XSL -

Introduction to XSL

- - - -
-

Overview -

- - - - - - - -
-

Intro

- - - - - - - -
-

History: XML and SGML

- - - - - - - -
-

History: What are stylesheets?

- - - - - - - -
-

History: FOSI

- - - - - - \ No newline at end of file diff --git a/Lib/test/test_minidom.py b/Lib/test/test_minidom.py index 7ccb8f4..a8c0b10 100644 --- a/Lib/test/test_minidom.py +++ b/Lib/test/test_minidom.py @@ -19,7 +19,7 @@ if __name__ == "__main__": base = sys.argv[0] else: base = __file__ -tstfile = os.path.join(os.path.dirname(base), "test"+os.extsep+"xml") +tstfile = os.path.join(os.path.dirname(base), "xmltestdata", "test.xml") del base # The tests of DocumentType importing use these helpers to construct diff --git a/Lib/test/test_sax.py b/Lib/test/test_sax.py index c582985..22048e6 100644 --- a/Lib/test/test_sax.py +++ b/Lib/test/test_sax.py @@ -17,6 +17,9 @@ from test.test_support import findfile, run_unittest import unittest import os +TEST_XMLFILE = findfile(os.path.join("xmltestdata", "test.xml")) +TEST_XMLFILE_OUT = findfile(os.path.join("xmltestdata", "test.xml.out")) + ns_uri = "http://www.python.org/xml-ns/saxtest/" class XmlTestBase(unittest.TestCase): @@ -311,7 +314,7 @@ class XMLFilterBaseTest(unittest.TestCase): # # =========================================================================== -xml_test_out = open(findfile("test"+os.extsep+"xml"+os.extsep+"out")).read() +xml_test_out = open(TEST_XMLFILE_OUT).read() class ExpatReaderTest(XmlTestBase): @@ -323,7 +326,7 @@ class ExpatReaderTest(XmlTestBase): xmlgen = XMLGenerator(result) parser.setContentHandler(xmlgen) - parser.parse(open(findfile("test"+os.extsep+"xml"))) + parser.parse(open(TEST_XMLFILE)) self.assertEquals(result.getvalue(), xml_test_out) @@ -452,7 +455,7 @@ class ExpatReaderTest(XmlTestBase): xmlgen = XMLGenerator(result) parser.setContentHandler(xmlgen) - parser.parse(findfile("test"+os.extsep+"xml")) + parser.parse(TEST_XMLFILE) self.assertEquals(result.getvalue(), xml_test_out) @@ -462,7 +465,7 @@ class ExpatReaderTest(XmlTestBase): xmlgen = XMLGenerator(result) parser.setContentHandler(xmlgen) - parser.parse(InputSource(findfile("test"+os.extsep+"xml"))) + parser.parse(InputSource(TEST_XMLFILE)) self.assertEquals(result.getvalue(), xml_test_out) @@ -473,7 +476,7 @@ class ExpatReaderTest(XmlTestBase): parser.setContentHandler(xmlgen) inpsrc = InputSource() - inpsrc.setByteStream(open(findfile("test"+os.extsep+"xml"))) + inpsrc.setByteStream(open(TEST_XMLFILE)) parser.parse(inpsrc) self.assertEquals(result.getvalue(), xml_test_out) @@ -534,9 +537,9 @@ class ExpatReaderTest(XmlTestBase): xmlgen = XMLGenerator(result) parser = create_parser() parser.setContentHandler(xmlgen) - parser.parse(findfile("test.xml")) + parser.parse(TEST_XMLFILE) - self.assertEquals(parser.getSystemId(), findfile("test.xml")) + self.assertEquals(parser.getSystemId(), TEST_XMLFILE) self.assertEquals(parser.getPublicId(), None) diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py index bc8b620..b99e42a 100644 --- a/Lib/test/test_xml_etree.py +++ b/Lib/test/test_xml_etree.py @@ -17,6 +17,9 @@ from test import test_support from xml.etree import ElementTree as ET +SIMPLE_XMLFILE = "xmltestdata/simple.xml" +SIMPLE_NS_XMLFILE = "xmltestdata/simple-ns.xml" + SAMPLE_XML = """\ text @@ -418,7 +421,7 @@ def file_init(): >>> tree.find("section/tag").tag 'tag' - >>> tree = ET.ElementTree(file="samples/simple.xml") + >>> tree = ET.ElementTree(file=SIMPLE_XMLFILE) >>> tree.find("element").tag 'element' >>> tree.find("element/../empty-element").tag @@ -564,7 +567,7 @@ def parsefile(): """ Test parsing from file. - >>> tree = ET.parse("samples/simple.xml") + >>> tree = ET.parse(SIMPLE_XMLFILE) >>> normalize_crlf(tree) >>> tree.write(sys.stdout) @@ -572,7 +575,7 @@ def parsefile(): texttail - >>> tree = ET.parse("samples/simple-ns.xml") + >>> tree = ET.parse(SIMPLE_NS_XMLFILE) >>> normalize_crlf(tree) >>> tree.write(sys.stdout) @@ -584,7 +587,7 @@ def parsefile(): >>> parser = ET.XMLParser() >>> parser.version # XXX: Upgrade to 2.0.1? 'Expat 2.0.0' - >>> parser.feed(open("samples/simple.xml").read()) + >>> parser.feed(open(SIMPLE_XMLFILE).read()) >>> print serialize(parser.close()) text @@ -593,7 +596,7 @@ def parsefile(): >>> parser = ET.XMLTreeBuilder() # 1.2 compatibility - >>> parser.feed(open("samples/simple.xml").read()) + >>> parser.feed(open(SIMPLE_XMLFILE).read()) >>> print serialize(parser.close()) text @@ -603,7 +606,7 @@ def parsefile(): >>> target = ET.TreeBuilder() >>> parser = ET.XMLParser(target=target) - >>> parser.feed(open("samples/simple.xml").read()) + >>> parser.feed(open(SIMPLE_XMLFILE).read()) >>> print serialize(parser.close()) text @@ -644,7 +647,7 @@ def iterparse(): >>> iterparse = ET.iterparse - >>> context = iterparse("samples/simple.xml") + >>> context = iterparse(SIMPLE_XMLFILE) >>> action, elem = next(context) >>> print action, elem.tag end element @@ -656,7 +659,7 @@ def iterparse(): >>> context.root.tag 'root' - >>> context = iterparse("samples/simple-ns.xml") + >>> context = iterparse(SIMPLE_NS_XMLFILE) >>> for action, elem in context: ... print action, elem.tag end {namespace}element @@ -665,17 +668,17 @@ def iterparse(): end {namespace}root >>> events = () - >>> context = iterparse("samples/simple.xml", events) + >>> context = iterparse(SIMPLE_XMLFILE, events) >>> for action, elem in context: ... print action, elem.tag >>> events = () - >>> context = iterparse("samples/simple.xml", events=events) + >>> context = iterparse(SIMPLE_XMLFILE, events=events) >>> for action, elem in context: ... print action, elem.tag >>> events = ("start", "end") - >>> context = iterparse("samples/simple.xml", events) + >>> context = iterparse(SIMPLE_XMLFILE, events) >>> for action, elem in context: ... print action, elem.tag start root @@ -688,7 +691,7 @@ def iterparse(): end root >>> events = ("start", "end", "start-ns", "end-ns") - >>> context = iterparse("samples/simple-ns.xml", events) + >>> context = iterparse(SIMPLE_NS_XMLFILE, events) >>> for action, elem in context: ... if action in ("start", "end"): ... print action, elem.tag @@ -706,7 +709,7 @@ def iterparse(): end-ns None >>> events = ("start", "end", "bogus") - >>> context = iterparse("samples/simple.xml", events) + >>> context = iterparse(SIMPLE_XMLFILE, events) Traceback (most recent call last): ValueError: unknown event 'bogus' @@ -767,7 +770,7 @@ def custom_builder(): ... pass >>> builder = Builder() >>> parser = ET.XMLParser(target=builder) - >>> parser.feed(open("samples/simple.xml", "r").read()) + >>> parser.feed(open(SIMPLE_XMLFILE, "r").read()) start root start element end element @@ -790,7 +793,7 @@ def custom_builder(): ... print "comment", repr(data) >>> builder = Builder() >>> parser = ET.XMLParser(target=builder) - >>> parser.feed(open("samples/simple-ns.xml", "r").read()) + >>> parser.feed(open(SIMPLE_NS_XMLFILE, "r").read()) pi pi 'data' comment ' comment ' start {namespace}root @@ -808,7 +811,7 @@ def getchildren(): """ Test Element.getchildren() - >>> tree = ET.parse(open("samples/simple.xml", "r")) + >>> tree = ET.parse(open(SIMPLE_XMLFILE, "r")) >>> for elem in tree.getroot().iter(): ... summarize_list(elem.getchildren()) ['element', 'element', 'empty-element'] @@ -1286,9 +1289,9 @@ XINCLUDE["default.xml"] = """\

Example.

- +
-""" +""".format(SIMPLE_XMLFILE) def xinclude_loader(href, parse="xml", encoding=None): try: @@ -1822,8 +1825,10 @@ def test_main(module_name='xml.etree.ElementTree'): from test import test_xml_etree def ignore(message, category=DeprecationWarning): warnings.filterwarnings("ignore", message, category) + # The same doctests are used for both the Python and the C implementations assert test_xml_etree.ET.__name__ == module_name + with warnings.catch_warnings(), CleanContext(): # Search behaviour is broken if search path starts with "/". ignore("This search is broken in 1.3 and earlier, and will be fixed " @@ -1838,8 +1843,8 @@ def test_main(module_name='xml.etree.ElementTree'): test_support.run_doctest(test_xml_etree, verbosity=True) - # The module should not be changed by the tests - assert test_xml_etree.ET.__name__ == module_name + # The module should not be changed by the tests + assert test_xml_etree.ET.__name__ == module_name if __name__ == '__main__': test_main() diff --git a/Lib/test/test_xml_etree_c.py b/Lib/test/test_xml_etree_c.py index 7e978de..78a6a92 100644 --- a/Lib/test/test_xml_etree_c.py +++ b/Lib/test/test_xml_etree_c.py @@ -22,13 +22,18 @@ def test_main(): test_support.run_doctest(test_xml_etree_c, verbosity=True) # Assign the C implementation before running the doctests + # Patch the __name__, to prevent confusion with the pure Python test pyET = test_xml_etree.ET + py__name__ = test_xml_etree.__name__ test_xml_etree.ET = cET + if __name__ != '__main__': + test_xml_etree.__name__ = __name__ try: # Run the same test suite as xml.etree.ElementTree test_xml_etree.test_main(module_name='xml.etree.cElementTree') finally: test_xml_etree.ET = pyET + test_xml_etree.__name__ = py__name__ if __name__ == '__main__': test_main() diff --git a/Lib/test/xmltestdata/simple-ns.xml b/Lib/test/xmltestdata/simple-ns.xml new file mode 100644 index 0000000..f1f34b2 --- /dev/null +++ b/Lib/test/xmltestdata/simple-ns.xml @@ -0,0 +1,7 @@ + + + + text + texttail + + diff --git a/Lib/test/xmltestdata/simple.xml b/Lib/test/xmltestdata/simple.xml new file mode 100644 index 0000000..b88c2c7 --- /dev/null +++ b/Lib/test/xmltestdata/simple.xml @@ -0,0 +1,6 @@ + + + text + texttail + + diff --git a/Lib/test/xmltestdata/test.xml b/Lib/test/xmltestdata/test.xml new file mode 100644 index 0000000..9af92fb --- /dev/null +++ b/Lib/test/xmltestdata/test.xml @@ -0,0 +1,115 @@ + + +Introduction to XSL +

Introduction to XSL

+ + + +
+

Overview +

+
    + +
  • 1.Intro
  • + +
  • 2.History
  • + +
  • 3.XSL Basics
  • + +
  • Lunch
  • + +
  • 4.An XML Data Model
  • + +
  • 5.XSL Patterns
  • + +
  • 6.XSL Templates
  • + +
  • 7.XSL Formatting Model +
  • + +
+ + + + + + +
+

Intro

+
    + +
  • Who am I?
  • + +
  • Who are you?
  • + +
  • Why are we here? +
  • + +
+ + + + + + +
+

History: XML and SGML

+
    + +
  • XML is a subset of SGML.
  • + +
  • SGML allows the separation of abstract content from formatting.
  • + +
  • Also one of XML's primary virtues (in the doc publishing domain). +
  • + +
+ + + + + + +
+

History: What are stylesheets?

+
    + +
  • Stylesheets specify the formatting of SGML/XML documents.
  • + +
  • Stylesheets put the "style" back into documents.
  • + +
  • New York Times content+NYT Stylesheet = NYT paper +
  • + +
+ + + + + + +
+

History: FOSI

+
    + +
  • FOSI: "Formatted Output Specification Instance" +
      +
    • MIL-STD-28001 +
    • + +
    • FOSI's are SGML documents +
    • + +
    • A stylesheet for another document +
    • +
  • + +
  • Obsolete but implemented... +
  • + +
+ + + + + diff --git a/Lib/test/xmltestdata/test.xml.out b/Lib/test/xmltestdata/test.xml.out new file mode 100644 index 0000000..d4ab1ab --- /dev/null +++ b/Lib/test/xmltestdata/test.xml.out @@ -0,0 +1,115 @@ + + +Introduction to XSL +

Introduction to XSL

+ + + +
+

Overview +

+
    + +
  • 1.Intro
  • + +
  • 2.History
  • + +
  • 3.XSL Basics
  • + +
  • Lunch
  • + +
  • 4.An XML Data Model
  • + +
  • 5.XSL Patterns
  • + +
  • 6.XSL Templates
  • + +
  • 7.XSL Formatting Model +
  • + +
+ + + + + + +
+

Intro

+
    + +
  • Who am I?
  • + +
  • Who are you?
  • + +
  • Why are we here? +
  • + +
+ + + + + + +
+

History: XML and SGML

+
    + +
  • XML is a subset of SGML.
  • + +
  • SGML allows the separation of abstract content from formatting.
  • + +
  • Also one of XML's primary virtues (in the doc publishing domain). +
  • + +
+ + + + + + +
+

History: What are stylesheets?

+
    + +
  • Stylesheets specify the formatting of SGML/XML documents.
  • + +
  • Stylesheets put the "style" back into documents.
  • + +
  • New York Times content+NYT Stylesheet = NYT paper +
  • + +
+ + + + + + +
+

History: FOSI

+
    + +
  • FOSI: "Formatted Output Specification Instance" +
      +
    • MIL-STD-28001 +
    • + +
    • FOSI's are SGML documents +
    • + +
    • A stylesheet for another document +
    • +
  • + +
  • Obsolete but implemented... +
  • + +
+ + + + + \ No newline at end of file diff --git a/Makefile.pre.in b/Makefile.pre.in index 2247a56..d2fb4be 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -833,7 +833,7 @@ PLATMACDIRS= plat-mac plat-mac/Carbon plat-mac/lib-scriptpackages \ plat-mac/lib-scriptpackages/Terminal PLATMACPATH=:plat-mac:plat-mac/lib-scriptpackages LIBSUBDIRS= lib-tk site-packages test test/output test/data \ - test/decimaltestdata \ + test/decimaltestdata test/xmltestdata \ encodings compiler hotshot \ email email/mime email/test email/test/data \ json json/tests \ diff --git a/Tools/msi/msi.py b/Tools/msi/msi.py index eba29cc..84215a1 100644 --- a/Tools/msi/msi.py +++ b/Tools/msi/msi.py @@ -1005,8 +1005,6 @@ def add_files(db): lib.add_file("audiotest.au") lib.add_file("cfgparser.1") lib.add_file("sgml_input.html") - lib.add_file("test.xml") - lib.add_file("test.xml.out") lib.add_file("testtar.tar") lib.add_file("test_difflib_expect.html") lib.add_file("check_soundcard.vbs") @@ -1018,6 +1016,9 @@ def add_files(db): lib.add_file("zipdir.zip") if dir=='decimaltestdata': lib.glob("*.decTest") + if dir=='xmltestdata': + lib.glob("*.xml") + lib.add_file("test.xml.out") if dir=='output': lib.glob("test_*") if dir=='idlelib': -- cgit v0.12