summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2001-04-25 16:03:54 (GMT)
committerFred Drake <fdrake@acm.org>2001-04-25 16:03:54 (GMT)
commit8f42e2b1fa101dc8a3e3ab371823ff5601b8a58b (patch)
treee5f3272845a05eb35445be1add8a9a981e78e505
parentcde79131eac7d4a6ddfe13b8b082a5869af9cf9e (diff)
downloadcpython-8f42e2b1fa101dc8a3e3ab371823ff5601b8a58b.zip
cpython-8f42e2b1fa101dc8a3e3ab371823ff5601b8a58b.tar.gz
cpython-8f42e2b1fa101dc8a3e3ab371823ff5601b8a58b.tar.bz2
Update test to accomodate the change to the namespace_separator parameter
of ParserCreate(). Added assignment tests for the ordered_attributes and specified_attributes values, similar to the checks for the returns_unicode attribute.
-rw-r--r--Lib/test/output/test_pyexpat12
-rw-r--r--Lib/test/test_pyexpat.py30
2 files changed, 32 insertions, 10 deletions
diff --git a/Lib/test/output/test_pyexpat b/Lib/test/output/test_pyexpat
index da07312..61fe81d 100644
--- a/Lib/test/output/test_pyexpat
+++ b/Lib/test/output/test_pyexpat
@@ -3,6 +3,14 @@ OK.
OK.
OK.
OK.
+OK.
+OK.
+OK.
+OK.
+OK.
+OK.
+OK.
+OK.
PI:
'xml-stylesheet' 'href="stylesheet.css"'
Comment:
@@ -99,6 +107,4 @@ Legal values tested o.k.
Caught expected TypeError:
ParserCreate() argument 2 must be string or None, not int
Caught expected ValueError:
-namespace_separator must be one character, omitted, or None
-Caught expected ValueError:
-namespace_separator must be one character, omitted, or None
+namespace_separator must be at most one character, omitted, or None
diff --git a/Lib/test/test_pyexpat.py b/Lib/test/test_pyexpat.py
index 0c400b4..fecb27e 100644
--- a/Lib/test/test_pyexpat.py
+++ b/Lib/test/test_pyexpat.py
@@ -75,6 +75,18 @@ parser.returns_unicode = 1; confirm(parser.returns_unicode == 1)
parser.returns_unicode = 2; confirm(parser.returns_unicode == 1)
parser.returns_unicode = 0; confirm(parser.returns_unicode == 0)
+# Test getting/setting ordered_attributes
+parser.ordered_attributes = 0; confirm(parser.ordered_attributes == 0)
+parser.ordered_attributes = 1; confirm(parser.ordered_attributes == 1)
+parser.ordered_attributes = 2; confirm(parser.ordered_attributes == 1)
+parser.ordered_attributes = 0; confirm(parser.ordered_attributes == 0)
+
+# Test getting/setting specified_attributes
+parser.specified_attributes = 0; confirm(parser.specified_attributes == 0)
+parser.specified_attributes = 1; confirm(parser.specified_attributes == 1)
+parser.specified_attributes = 2; confirm(parser.specified_attributes == 1)
+parser.specified_attributes = 0; confirm(parser.specified_attributes == 0)
+
HANDLER_NAMES = [
'StartElementHandler', 'EndElementHandler',
'CharacterDataHandler', 'ProcessingInstructionHandler',
@@ -167,6 +179,7 @@ except TypeError, e:
print e
else:
print "Failed to catch expected TypeError."
+
try:
expat.ParserCreate(namespace_separator='too long')
except ValueError, e:
@@ -174,10 +187,13 @@ except ValueError, e:
print e
else:
print "Failed to catch expected ValueError."
-try:
- expat.ParserCreate(namespace_separator='') # too short
-except ValueError, e:
- print "Caught expected ValueError:"
- print e
-else:
- print "Failed to catch expected ValueError."
+
+# ParserCreate() needs to accept a namespace_separator of zero length
+# to satisfy the requirements of RDF applications that are required
+# to simply glue together the namespace URI and the localname. Though
+# considered a wart of the RDF specifications, it needs to be supported.
+#
+# See XML-SIG mailing list thread starting with
+# http://mail.python.org/pipermail/xml-sig/2001-April/005202.html
+#
+expat.ParserCreate(namespace_separator='') # too short