(self)
| 122 | |
| 123 | @support.cpython_only |
| 124 | def test_uninitialized_parser(self): |
| 125 | # The interpreter shouldn't crash in case of calling methods or |
| 126 | # accessing attributes of uninitialized XMLParser objects. |
| 127 | parser = cET.XMLParser.__new__(cET.XMLParser) |
| 128 | self.assertRaises(ValueError, parser.close) |
| 129 | self.assertRaises(ValueError, parser.feed, 'foo') |
| 130 | class MockFile: |
| 131 | def read(*args): |
| 132 | return '' |
| 133 | self.assertRaises(ValueError, parser._parse_whole, MockFile()) |
| 134 | self.assertRaises(ValueError, parser._setevents, None) |
| 135 | self.assertIsNone(parser.entity) |
| 136 | self.assertIsNone(parser.target) |
| 137 | |
| 138 | def test_setstate_leaks(self): |
| 139 | # Test reference leaks |
nothing calls this directly
no test coverage detected