blob: b14ead9aa06e212a87bfb4d06a8dbc0174bbcfe8 [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.*",
Tim Petersd3925062002-04-16 01:27:44 +000018 DeprecationWarning, r'xmllib$')
Tim Petersa7c2b302002-04-11 20:18:40 +000019
Barry Warsaw04f357c2002-07-23 19:04:11 +000020from test import test_support
Fred Drakebabd7372001-05-22 20:22:06 +000021import unittest
Guido van Rossum02505e41998-01-29 14:55:24 +000022import xmllib
Guido van Rossum02505e41998-01-29 14:55:24 +000023
Fred Drakebabd7372001-05-22 20:22:06 +000024class XMLParserTestCase(unittest.TestCase):
25
26 def test_simple(self):
27 parser = xmllib.XMLParser()
28 for c in testdoc:
29 parser.feed(c)
30 parser.close()
31
32
Fred Drake2e2be372001-09-20 21:33:42 +000033def test_main():
34 test_support.run_unittest(XMLParserTestCase)
Fred Drake2e2be372001-09-20 21:33:42 +000035
36if __name__ == "__main__":
37 test_main()