1998-01-29 10:55:24 -04:00
|
|
|
'''Test module to thest the xmllib module.
|
|
|
|
Sjoerd Mullender
|
|
|
|
'''
|
|
|
|
|
|
|
|
testdoc = """\
|
|
|
|
<?xml version="1.0" encoding="UTF-8" standalone='yes' ?>
|
|
|
|
<!-- comments aren't allowed before the <?xml?> tag,
|
|
|
|
but they are allowed before the <!DOCTYPE> tag -->
|
2001-05-22 17:22:06 -03:00
|
|
|
<?processing instructions are allowed in the same places as comments ?>
|
1998-01-29 10:55:24 -04:00
|
|
|
<!DOCTYPE greeting [
|
|
|
|
<!ELEMENT greeting (#PCDATA)>
|
|
|
|
]>
|
|
|
|
<greeting>Hello, world!</greeting>
|
|
|
|
"""
|
|
|
|
|
2002-04-11 17:18:40 -03:00
|
|
|
import warnings
|
|
|
|
warnings.filterwarnings("ignore", ".* xmllib .* obsolete.*",
|
2002-04-15 22:27:44 -03:00
|
|
|
DeprecationWarning, r'xmllib$')
|
2002-04-11 17:18:40 -03:00
|
|
|
|
2002-07-23 16:04:11 -03:00
|
|
|
from test import test_support
|
2001-05-22 17:22:06 -03:00
|
|
|
import unittest
|
1998-01-29 10:55:24 -04:00
|
|
|
import xmllib
|
|
|
|
|
2001-05-22 17:22:06 -03:00
|
|
|
class XMLParserTestCase(unittest.TestCase):
|
|
|
|
|
|
|
|
def test_simple(self):
|
|
|
|
parser = xmllib.XMLParser()
|
|
|
|
for c in testdoc:
|
|
|
|
parser.feed(c)
|
|
|
|
parser.close()
|
|
|
|
|
|
|
|
|
2001-09-20 18:33:42 -03:00
|
|
|
def test_main():
|
|
|
|
test_support.run_unittest(XMLParserTestCase)
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
test_main()
|