summaryrefslogtreecommitdiff
path: root/bs4/tests/test_css.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonardr@segfault.org>2023-02-03 22:07:19 -0500
committerLeonard Richardson <leonardr@segfault.org>2023-02-03 22:07:19 -0500
commit526fcf8d98ccc457d5943c83ab133fe49c174d1e (patch)
tree338bbe8d82a47eafcb7ceb0f2a0129f8ec8c721d /bs4/tests/test_css.py
parent1f0f15f9b3620f75b30b700c4764a4f09eca8376 (diff)
Added tests of CSS.escape.
Diffstat (limited to 'bs4/tests/test_css.py')
-rw-r--r--bs4/tests/test_css.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/bs4/tests/test_css.py b/bs4/tests/test_css.py
index 3da9aed..51662ed 100644
--- a/bs4/tests/test_css.py
+++ b/bs4/tests/test_css.py
@@ -2,6 +2,7 @@ import pytest
import types
from bs4 import (
+ CSS,
BeautifulSoup,
ResultSet,
)
@@ -466,3 +467,9 @@ class TestCSSSelectors(SoupTest):
assert isinstance(results, ResultSet)
[result] = results
assert result['id'] == 'header3'
+
+ def test_escape(self):
+ m = CSS.escape
+ assert m(".foo#bar") == '\\.foo\\#bar'
+ assert m("()[]{}") == '\\(\\)\\[\\]\\{\\}'
+ assert m(".foo") == self.soup.css.escape(".foo")