blob: 97ae14110172e7fb0381ff41f6bb56754142a108 [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
Tim Petersa7c2b302002-04-11 20:18:40 +000016import warnings
17warnings.filterwarnings("ignore", ".* xmllib .* obsolete.*",
18 DeprecationWarning)
19del warnings
20
Fred Drakebabd7372001-05-22 20:22:06 +000021import test_support
22import unittest
Guido van Rossum02505e41998-01-29 14:55:24 +000023import xmllib
Guido van Rossum02505e41998-01-29 14:55:24 +000024
Fred Drakebabd7372001-05-22 20:22:06 +000025class XMLParserTestCase(unittest.TestCase):
26
27 def test_simple(self):
28 parser = xmllib.XMLParser()
29 for c in testdoc:
30 parser.feed(c)
31 parser.close()
32
33
Fred Drake2e2be372001-09-20 21:33:42 +000034def test_main():
35 test_support.run_unittest(XMLParserTestCase)
36
37
38if __name__ == "__main__":
39 test_main()