blob: 9ea50420948320026f951839c11709df904e4bc9 [file] [log] [blame]
Guido van Rossum02505e41998-01-29 14:55:24 +00001'''Test module to thest the xmllib module.
2 Sjoerd Mullender
3'''
4
Guido van Rossum02505e41998-01-29 14:55:24 +00005testdoc = """\
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 -->
Fred Drakebabd7372001-05-22 20:22:06 +00009<?processing instructions are allowed in the same places as comments ?>
Guido van Rossum02505e41998-01-29 14:55:24 +000010<!DOCTYPE greeting [
11 <!ELEMENT greeting (#PCDATA)>
12]>
13<greeting>Hello, world!</greeting>
14"""
15
Fred Drakebabd7372001-05-22 20:22:06 +000016import test_support
17import unittest
Guido van Rossum02505e41998-01-29 14:55:24 +000018import xmllib
Guido van Rossum02505e41998-01-29 14:55:24 +000019
Fred Drakebabd7372001-05-22 20:22:06 +000020
21class 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
Fred Drake2e2be372001-09-20 21:33:42 +000030def test_main():
31 test_support.run_unittest(XMLParserTestCase)
32
33
34if __name__ == "__main__":
35 test_main()