added assets_formatter and remove_formatter

This commit is contained in:
truePhilipp committed 2024-05-14 22:13:30 +02:00
1 parent 8697f3ecb5
commit ddc9add551
6 files changed
+108 -7

No files matched your search

@@ -0,0 +1,23 @@
from unittest import TestCase
from bs4 import BeautifulSoup
from html_to_django.formatters import remove_formatter
class RemoveTests(TestCase):
def test_basic(self) -> None:
soup = BeautifulSoup('<div dj-remove><div>Test</div></div>', "html.parser")
remove_formatter.format(soup)
expected_result = ""
self.assertEqual(expected_result, str(soup))
def test_empty(self) -> None:
soup = BeautifulSoup('<div dj-remove></div>', "html.parser")
remove_formatter.format(soup)
expected_result = ""
self.assertEqual(expected_result, str(soup))
def test_with_remove_inside(self) -> None:
soup = BeautifulSoup('<div dj-remove><div dj-remove>Inner Test</div></div>', "html.parser")
remove_formatter.format(soup)
expected_result = ""
self.assertEqual(expected_result, str(soup))