Test reduce_html at reduction level 1 (remove unnecessary attributes and empty style tags).
()
| 99 | |
| 100 | |
| 101 | def test_reduce_html_reduction_1(): |
| 102 | """Test reduce_html at reduction level 1 (remove unnecessary attributes and empty style tags).""" |
| 103 | raw_html = """ |
| 104 | <html> |
| 105 | <body> |
| 106 | <div style="color:red" data-extra="should_remove" class="keep"> |
| 107 | <!-- comment should be removed --> |
| 108 | <p> Some text </p> |
| 109 | </div> |
| 110 | </body> |
| 111 | </html> |
| 112 | """ |
| 113 | reduced = reduce_html(raw_html, 1) |
| 114 | # Ensure that unwanted attributes are removed (data-extra and style are gone, class remains) |
| 115 | assert "data-extra" not in reduced |
| 116 | assert "style=" not in reduced |
| 117 | assert 'class="keep"' in reduced |
| 118 | |
| 119 | |
| 120 | def test_reduce_html_reduction_2(): |
nothing calls this directly
no test coverage detected