summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_sax.py
diff options
context:
space:
mode:
authorFlorent Xicluna <florent.xicluna@gmail.com>2010-03-13 23:24:31 (GMT)
committerFlorent Xicluna <florent.xicluna@gmail.com>2010-03-13 23:24:31 (GMT)
commitf15351d938e76c4b2a42a638825d67f108685140 (patch)
treed75a09f72c251d71a714f948f50392249bf91cd9 /Lib/test/test_sax.py
parent9451a1c6ae14cc31ea88eaaf68d5a8f946b82831 (diff)
downloadcpython-f15351d938e76c4b2a42a638825d67f108685140.zip
cpython-f15351d938e76c4b2a42a638825d67f108685140.tar.gz
cpython-f15351d938e76c4b2a42a638825d67f108685140.tar.bz2
Merged revisions 78838-78839,78917,78919,78934,78937 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r78838 | florent.xicluna | 2010-03-11 15:36:19 +0100 (jeu, 11 mar 2010) | 2 lines Issue #6472: The xml.etree package is updated to ElementTree 1.3. The cElementTree module is updated too. ........ r78839 | florent.xicluna | 2010-03-11 16:55:11 +0100 (jeu, 11 mar 2010) | 2 lines Fix repr of tree Element on windows. ........ r78917 | florent.xicluna | 2010-03-13 12:18:49 +0100 (sam, 13 mar 2010) | 2 lines Move the xml test data to their own directory. ........ r78919 | florent.xicluna | 2010-03-13 13:41:48 +0100 (sam, 13 mar 2010) | 2 lines Do not chdir when running test_xml_etree, and enhance the findfile helper. ........ r78934 | florent.xicluna | 2010-03-13 18:56:19 +0100 (sam, 13 mar 2010) | 2 lines Update some parts of the xml.etree documentation. ........ r78937 | florent.xicluna | 2010-03-13 21:30:15 +0100 (sam, 13 mar 2010) | 3 lines Add the keyword argument "method=None" to the .write() method and the tostring/tostringlist functions. Update the function, class and method signatures, according to the new convention. ........
Diffstat (limited to 'Lib/test/test_sax.py')
-rw-r--r--Lib/test/test_sax.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/Lib/test/test_sax.py b/Lib/test/test_sax.py
index 781cf51..9b28b3f 100644
--- a/Lib/test/test_sax.py
+++ b/Lib/test/test_sax.py
@@ -15,7 +15,9 @@ from xml.sax.xmlreader import InputSource, AttributesImpl, AttributesNSImpl
from io import StringIO
from test.support import findfile, run_unittest
import unittest
-import os
+
+TEST_XMLFILE = findfile("test.xml", subdir="xmltestdata")
+TEST_XMLFILE_OUT = findfile("test.xml.out", subdir="xmltestdata")
ns_uri = "http://www.python.org/xml-ns/saxtest/"
@@ -311,7 +313,7 @@ class XMLFilterBaseTest(unittest.TestCase):
#
# ===========================================================================
-xml_test_out = open(findfile("test.xml.out")).read()
+xml_test_out = open(TEST_XMLFILE_OUT).read()
class ExpatReaderTest(XmlTestBase):
@@ -323,7 +325,7 @@ class ExpatReaderTest(XmlTestBase):
xmlgen = XMLGenerator(result)
parser.setContentHandler(xmlgen)
- parser.parse(open(findfile("test.xml")))
+ parser.parse(open(TEST_XMLFILE))
self.assertEquals(result.getvalue(), xml_test_out)
@@ -452,7 +454,7 @@ class ExpatReaderTest(XmlTestBase):
xmlgen = XMLGenerator(result)
parser.setContentHandler(xmlgen)
- parser.parse(findfile("test.xml"))
+ parser.parse(TEST_XMLFILE)
self.assertEquals(result.getvalue(), xml_test_out)
@@ -462,7 +464,7 @@ class ExpatReaderTest(XmlTestBase):
xmlgen = XMLGenerator(result)
parser.setContentHandler(xmlgen)
- parser.parse(InputSource(findfile("test.xml")))
+ parser.parse(InputSource(TEST_XMLFILE))
self.assertEquals(result.getvalue(), xml_test_out)
@@ -473,7 +475,7 @@ class ExpatReaderTest(XmlTestBase):
parser.setContentHandler(xmlgen)
inpsrc = InputSource()
- inpsrc.setByteStream(open(findfile("test.xml")))
+ inpsrc.setByteStream(open(TEST_XMLFILE))
parser.parse(inpsrc)
self.assertEquals(result.getvalue(), xml_test_out)
@@ -534,9 +536,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)