(self)
| 230 | self.check_parseString(self.data) |
| 231 | |
| 232 | def test_parseString_bytes(self): |
| 233 | # UTF-8 is default encoding, US-ASCII is compatible with UTF-8, |
| 234 | # UTF-16 is autodetected |
| 235 | encodings = ('us-ascii', 'utf-8', 'utf-16', 'utf-16le', 'utf-16be') |
| 236 | for encoding in encodings: |
| 237 | self.check_parseString(xml_bytes(self.data, encoding)) |
| 238 | self.check_parseString(xml_bytes(self.data, encoding, None)) |
| 239 | # accept UTF-8 with BOM |
| 240 | self.check_parseString(xml_bytes(self.data, 'utf-8-sig', 'utf-8')) |
| 241 | self.check_parseString(xml_bytes(self.data, 'utf-8-sig', None)) |
| 242 | # accept data with declared encoding |
| 243 | self.check_parseString(xml_bytes(self.data, 'iso-8859-1')) |
| 244 | # fail on non-UTF-8 incompatible data without declared encoding |
| 245 | with self.assertRaises(SAXException): |
| 246 | self.check_parseString(xml_bytes(self.data, 'iso-8859-1', None)) |
| 247 | |
| 248 | class MakeParserTest(unittest.TestCase): |
| 249 | def test_make_parser2(self): |
nothing calls this directly
no test coverage detected