diff mbox series

[3/7] bitbake/lib/bs4/tests/test_tree.py: python 3.12 regex

Message ID 20240210131727.342583-4-adrian.freihofer@siemens.com
State Accepted, archived
Commit 1a3f01cad47b67fe326bc690103bf347f587f99a
Headers show
Series python 3.12 related fixes 2 | expand

Commit Message

Adrian Freihofer Feb. 10, 2024, 1:15 p.m. UTC
Python 3 interprets string literals as Unicode strings, and therefore
\s is treated as an escaped Unicode character which is not correct.
Declaring the RegEx pattern as a raw string instead of unicode is
required for Python 3.

Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
---
 bitbake/lib/bs4/tests/test_tree.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/bitbake/lib/bs4/tests/test_tree.py b/bitbake/lib/bs4/tests/test_tree.py
index 8e5c66426e8..cf0f1abe0cc 100644
--- a/bitbake/lib/bs4/tests/test_tree.py
+++ b/bitbake/lib/bs4/tests/test_tree.py
@@ -585,7 +585,7 @@  class SiblingTest(TreeTest):
                     </html>'''
         # All that whitespace looks good but makes the tests more
         # difficult. Get rid of it.
-        markup = re.compile("\n\s*").sub("", markup)
+        markup = re.compile(r"\n\s*").sub("", markup)
         self.tree = self.soup(markup)