From bb335b4fa1d565cc91a4c0733584114e7c006acf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20F=2E=20Aasen?= Date: Fri, 22 Mar 2024 11:07:44 +0100 Subject: [PATCH] Properly escape '\s' in test file In Python 3.12 a SyntaxWarning is generated if there is any invalid escape sequences. --- test/data/javascript/python.mustache | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/data/javascript/python.mustache b/test/data/javascript/python.mustache index c9e882a5..5cc5b950 100644 --- a/test/data/javascript/python.mustache +++ b/test/data/javascript/python.mustache @@ -79,9 +79,9 @@ class TestJSBeautifier(unittest.TestCase): bt('"\\x41\\x42\\x43\\x01"', '"\\x41\\x42\\x43\\x01"') bt('"\\u2022"', '"\\u2022"') bt('"\\u{2022}"', '"\\u{2022}"') - bt('a = /\s+/') + bt('a = /\\s+/') #bt('a = /\\x41/','a = /A/') - bt('"\\u2022";a = /\s+/;"\\x41\\x42\\x43\\x01".match(/\\x41/);','"\\u2022";\na = /\s+/;\n"\\x41\\x42\\x43\\x01".match(/\\x41/);') + bt('"\\u2022";a = /\\s+/;"\\x41\\x42\\x43\\x01".match(/\\x41/);','"\\u2022";\na = /\\s+/;\n"\\x41\\x42\\x43\\x01".match(/\\x41/);') test_fragment('"\\x41\\x42\\x01\\x43"') test_fragment('"\\x41\\x42\\u0001\\x43"') @@ -105,7 +105,7 @@ class TestJSBeautifier(unittest.TestCase): test_fragment('"\\u0072\\u016B\\u0137\\u012B\\u0074\\u0069\\u0073"', six.u('"\u0072\u016B\u0137\u012B\u0074\u0069\u0073"')) test_fragment('"\\u{0072}\\u{016B}\\u{110000}\\u{137}\\u012B\\x74\\u{0000069}\\u{073}"', six.u('"\u0072\u016B\\u{110000}\u0137\u012B\u0074\u0069\u0073"')) - bt('a = /\s+/') + bt('a = /\\s+/') test_fragment('"\\x22\\x27",\'\\x22\\x27\',"\\x5c",\'\\x5c\',"\\xff","unicode \\u0000 \\u0022 \\u0027 \\u005c \\uffff"', '"\\"\\\'", \'\\"\\\'\', "\\\\", \'\\\\\', "\\xff", "unicode \\u0000 \\" \\\' \\\\ ' + unicode_char(0xffff) + '"')