Guido van Rossum | 02505e4 | 1998-01-29 14:55:24 +0000 | [diff] [blame] | 1 | '''Test module to thest the xmllib module. |
| 2 | Sjoerd Mullender |
| 3 | ''' |
| 4 | |
Guido van Rossum | 02505e4 | 1998-01-29 14:55:24 +0000 | [diff] [blame] | 5 | testdoc = """\ |
| 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 Drake | babd737 | 2001-05-22 20:22:06 +0000 | [diff] [blame^] | 9 | <?processing instructions are allowed in the same places as comments ?> |
Guido van Rossum | 02505e4 | 1998-01-29 14:55:24 +0000 | [diff] [blame] | 10 | <!DOCTYPE greeting [ |
| 11 | <!ELEMENT greeting (#PCDATA)> |
| 12 | ]> |
| 13 | <greeting>Hello, world!</greeting> |
| 14 | """ |
| 15 | |
Fred Drake | babd737 | 2001-05-22 20:22:06 +0000 | [diff] [blame^] | 16 | import test_support |
| 17 | import unittest |
Guido van Rossum | 02505e4 | 1998-01-29 14:55:24 +0000 | [diff] [blame] | 18 | import xmllib |
Guido van Rossum | 02505e4 | 1998-01-29 14:55:24 +0000 | [diff] [blame] | 19 | |
Fred Drake | babd737 | 2001-05-22 20:22:06 +0000 | [diff] [blame^] | 20 | |
| 21 | class 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 | |
| 30 | test_support.run_unittest(XMLParserTestCase) |