(self)
| 846 | ) |
| 847 | |
| 848 | def test_indent_level(self): |
| 849 | elem = ET.XML("<html><body><p>pre<br/>post</p><p>text</p></body></html>") |
| 850 | with self.assertRaises(ValueError): |
| 851 | ET.indent(elem, level=-1) |
| 852 | self.assertEqual( |
| 853 | ET.tostring(elem), |
| 854 | b"<html><body><p>pre<br />post</p><p>text</p></body></html>" |
| 855 | ) |
| 856 | |
| 857 | ET.indent(elem, level=2) |
| 858 | self.assertEqual( |
| 859 | ET.tostring(elem), |
| 860 | b'<html>\n' |
| 861 | b' <body>\n' |
| 862 | b' <p>pre<br />post</p>\n' |
| 863 | b' <p>text</p>\n' |
| 864 | b' </body>\n' |
| 865 | b' </html>' |
| 866 | ) |
| 867 | |
| 868 | elem = ET.XML("<html><body><p>pre<br/>post</p><p>text</p></body></html>") |
| 869 | ET.indent(elem, level=1, space=' ') |
| 870 | self.assertEqual( |
| 871 | ET.tostring(elem), |
| 872 | b'<html>\n' |
| 873 | b' <body>\n' |
| 874 | b' <p>pre<br />post</p>\n' |
| 875 | b' <p>text</p>\n' |
| 876 | b' </body>\n' |
| 877 | b' </html>' |
| 878 | ) |
| 879 | |
| 880 | def test_tostring_default_namespace(self): |
| 881 | elem = ET.XML('<body xmlns="http://effbot.org/ns"><tag/></body>') |
nothing calls this directly
no test coverage detected