(self)
| 227 | tree = ET.ElementTree(ET.ElementTree()) |
| 228 | |
| 229 | def test_setroot(self): |
| 230 | # Test _setroot behavior. |
| 231 | |
| 232 | tree = ET.ElementTree() |
| 233 | element = ET.Element("tag") |
| 234 | tree._setroot(element) |
| 235 | self.assertEqual(tree.getroot().tag, "tag") |
| 236 | self.assertEqual(tree.getroot(), element) |
| 237 | |
| 238 | # Test behavior with an invalid root element |
| 239 | |
| 240 | tree = ET.ElementTree() |
| 241 | with self.assertRaises(TypeError): |
| 242 | tree._setroot("") |
| 243 | with self.assertRaises(TypeError): |
| 244 | tree._setroot(ET.ElementTree()) |
| 245 | with self.assertRaises(TypeError): |
| 246 | tree._setroot(None) |
| 247 | |
| 248 | def test_interface(self): |
| 249 | # Test element tree interface. |
nothing calls this directly
no test coverage detected