Skip to content

Commit

Permalink
Remove unnecessary test case
Browse files Browse the repository at this point in the history
  • Loading branch information
Gallaecio committed Jun 14, 2024
1 parent e7c5e97 commit 122c0f0
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions tests/test_selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -1007,27 +1007,16 @@ def test_remove_selector(self) -> None:
self.assertIsSelectorList(sel.css("li"))
self.assertEqual(sel.css("li::text").getall(), ["2", "3"])

def test_remove_selector_from_html_in_text(self) -> None:
html = (
"<html><body><style>p{color:red;}</style><p>hello world</p></body></html>"
)
expect_result = "<html><body><p>hello world</p></body></html>"
sel = self.sscls(text=html, type="html")
self.assertEqual(sel.type, "html")
li_sel_list = sel.css("style")
li_sel_list.drop()
self.assertEqual(sel.get(), expect_result)
# The type of the parent selector should not change
self.assertEqual(sel.type, "html")

def test_remove_selector_from_html_in_json(self) -> None:
def test_remove_selector_from_nested_html(self) -> None:
json_str = """{
"title": "hello world",
"body": "<html><body><style>p{color:red;}</style><p>hello world</p></body></html>"
}
"""
expect_result = "<html><body><p>hello world</p></body></html>"
sel = self.sscls(text=json_str)
# We need to force the selector type to HTML to make that functionality
# readily available.
html_sel = sel.jmespath("body", type="html")[0]
self.assertEqual(html_sel.type, "html")
li_sel_list = html_sel.css("style")
Expand Down

0 comments on commit 122c0f0

Please sign in to comment.