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>
|
|
|
|
"""
|
|
|
|
|
2001-05-22 17:22:06 -03:00
|
|
|
import test_support
|
|
|
|
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()
|