CVS: Products/ParsedXML/tests - demo_aqpain.py:1.2 test_parser.py:1.11 test_prettyprinter.py:1.4 test_printer.py:NONE
Martijn Faassen <[email protected]> Tue, 27 Apr 2004 13:59:21 -0400
| Newsgroups | gmane.comp.web.zope.parsed-xml |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvs-repository/Products/ParsedXML/tests
In directory cvs.zope.org:/tmp/cvs-serv4366/tests
Modified Files:
demo_aqpain.py test_parser.py test_prettyprinter.py
Removed Files:
test_printer.py
Log Message:
Get rid of the old Printer.
Simplify the current printer, ripping out HTML support (ParsedXML doesn't
really need to handle HTML), and ripping out unused pathways of using
encoding and contentType settings.
=== Products/ParsedXML/tests/demo_aqpain.py 1.1 => 1.2 ===
--- Products/ParsedXML/tests/demo_aqpain.py:1.1 Tue Apr 27 12:41:22 2004
+++ Products/ParsedXML/tests/demo_aqpain.py Tue Apr 27 13:59:20 2004
@@ -47,13 +47,11 @@
ZopeTestCase.installProduct('ParsedXML')
from Products.ParsedXML.DOM.ExpatBuilder import ExpatBuilder
-from Products.ParsedXML.Printer import PrintVisitor
class AcquisitionPainTestCase(ZopeTestCase.ZopeTestCase):
def afterSetUp(self):
self.doc = ExpatBuilder().parseString("<doc><e1/><e2/></doc>")
- self.printer = PrintVisitor(self.doc)
def testParentReferenceIntegrity(self):
e1a = self.doc.documentElement.firstChild
=== Products/ParsedXML/tests/test_parser.py 1.10 => 1.11 ===
--- Products/ParsedXML/tests/test_parser.py:1.10 Tue Apr 27 12:41:22 2004
+++ Products/ParsedXML/tests/test_parser.py Tue Apr 27 13:59:20 2004
@@ -23,10 +23,19 @@
from domapi.Base import checkAttribute
-from Products.ParsedXML import ParsedXML, Printer, ExtraDOM, DOM
+from Products.ParsedXML import ParsedXML, ExtraDOM, DOM, PrettyPrinter
from StringIO import StringIO
+
# the printer is a convenient way to track changes made by the parser
-from test_printer import printElement, checkOutput
+def printElement(element):
+ output = StringIO()
+ PrettyPrinter.PrintVisitor(element, output)()
+ return output.getvalue()
+
+def checkOutput(wanted, got, message="Bad output"):
+ assert wanted == got, \
+ ("%s. Wanted:\n%s[[EOF]]\nGot:\n%s[[EOF]]\n"
+ % (message, wanted, got))
class ParsedXMLTestCaseBase(ZopeTestCase.ZopeTestCase):
=== Products/ParsedXML/tests/test_prettyprinter.py 1.3 => 1.4 ===
--- Products/ParsedXML/tests/test_prettyprinter.py:1.3 Tue Apr 27 12:41:22 2004
+++ Products/ParsedXML/tests/test_prettyprinter.py Tue Apr 27 13:59:20 2004
@@ -24,9 +24,9 @@
from Products.ParsedXML import ParsedXML, PrettyPrinter
from StringIO import StringIO
-def printElement(element, encoding = None, html = 0, contentType = None):
+def printElement(element):
output = StringIO()
- PrettyPrinter.PrintVisitor(element, output, encoding, html, contentType)()
+ PrettyPrinter.PrintVisitor(element, output)()
return output.getvalue()
def checkOutput(wanted, got, message="Bad output"):
@@ -89,31 +89,6 @@
#currently we're expanding aggressively, but it's not a priority
#because the parser gets to play around with refs too
-class HTMLPrintTestCase(PrintTestBase):
-
- def testMinimize(self):
- inStr = ('<html><p><hr/><hr noshade="1"/></p><p/><p></p>' +
- '<p align="center" /></html>')
- outStr = ('<html><p><hr /><hr noshade="1" /></p><p></p><p></p>' +
- '<p align="center"></p></html>\n')
- doc = self.parse(inStr)
- output = printElement(doc, encoding = None, html = 1)
-
- checkOutput(outStr, output, "improper HTML minimization")
-
- def testCapitalize(self):
- inStr = ('<html><HR nOsHaDe="1" /></html>\n')
- doc = self.parse(inStr)
- output = printElement(doc, encoding = None, html = 1,
- contentType = 'html')
- checkOutput(inStr.upper(), output,
- "improper HTML contenttype HTML capitalization")
- output = printElement(doc, encoding = None, html = 1,
- contentType = 'xml')
- checkOutput(inStr.lower(), output,
- "improper XML contenttype HTML capitalization")
-
-
class Lvl2PrintTestCase(PrintTestBase):
def testNamespacePrint(self):
@@ -180,6 +155,5 @@
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(PrintTestCase))
- suite.addTest(unittest.makeSuite(HTMLPrintTestCase))
suite.addTest(unittest.makeSuite(Lvl2PrintTestCase))
return suite
=== Removed File Products/ParsedXML/tests/test_printer.py ===