diff mbox series

[kirkstone,2.0,3/6] bitbake/lib/bs4/tests/test_tree.py: python 3.12 regex

Message ID 7efed7bc09c56e41d3074a26388581a62f145625.1709071317.git.steve@sakoman.com
State Accepted, archived
Commit 7efed7bc09c56e41d3074a26388581a62f145625
Headers show
Series [kirkstone,2.0,1/6] codeparser: replace deprecated ast.Str and 's' | expand

Commit Message

Steve Sakoman Feb. 27, 2024, 10:04 p.m. UTC
From: Adrian Freihofer <adrian.freihofer@gmail.com>

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>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
---
 lib/bs4/tests/test_tree.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/lib/bs4/tests/test_tree.py b/lib/bs4/tests/test_tree.py
index 8e5c66426..cf0f1abe0 100644
--- a/lib/bs4/tests/test_tree.py
+++ b/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)