home *** CD-ROM | disk | FTP | other *** search
/ Komputer for Alle 2004 #2 / K-CD-2-2004.ISO / OpenOffice Sv / f_0397 / python-core-2.2.2 / lib / test / test_xmllib.py < prev    next >
Encoding:
Python Source  |  2003-07-18  |  766 b   |  36 lines

  1. '''Test module to thest the xmllib module.
  2.    Sjoerd Mullender
  3. '''
  4.  
  5. testdoc = """\
  6. <?xml version="1.0" encoding="UTF-8" standalone='yes' ?>
  7. <!-- comments aren't allowed before the <?xml?> tag,
  8.      but they are allowed before the <!DOCTYPE> tag -->
  9. <?processing instructions are allowed in the same places as comments ?>
  10. <!DOCTYPE greeting [
  11.   <!ELEMENT greeting (#PCDATA)>
  12. ]>
  13. <greeting>Hello, world!</greeting>
  14. """
  15.  
  16. import test_support
  17. import unittest
  18. import xmllib
  19.  
  20.  
  21. class XMLParserTestCase(unittest.TestCase):
  22.  
  23.     def test_simple(self):
  24.         parser = xmllib.XMLParser()
  25.         for c in testdoc:
  26.             parser.feed(c)
  27.         parser.close()
  28.  
  29.  
  30. def test_main():
  31.     test_support.run_unittest(XMLParserTestCase)
  32.  
  33.  
  34. if __name__ == "__main__":
  35.     test_main()
  36.