From 7aaf5f5330bf5043809bc4124c972941dc512d07 Mon Sep 17 00:00:00 2001 From: Jakub Wilk Date: Fri, 30 Dec 2016 11:20:26 +0100 Subject: [PATCH] Fix invalid escape sequences Fixes: hy/cmdline.py:175: DeprecationWarning: invalid escape sequence \_ tests/lex/test_lex.py:267: DeprecationWarning: invalid escape sequence \s tests/compilers/test_compiler.py:45: DeprecationWarning: invalid escape sequence \* when run against Python 3.6 with warnings enabled. --- hy/cmdline.py | 2 +- tests/compilers/test_compiler.py | 2 +- tests/lex/test_lex.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hy/cmdline.py b/hy/cmdline.py index b938df2..8ef5d4b 100644 --- a/hy/cmdline.py +++ b/hy/cmdline.py @@ -144,7 +144,7 @@ def koan_macro(): @macro("ideas") def ideas_macro(): return HyExpression([HySymbol('print'), - HyString(""" + HyString(r""" => (import [sh [figlet]]) => (figlet "Hi, Hy!") diff --git a/tests/compilers/test_compiler.py b/tests/compilers/test_compiler.py index 063bdda..35e92ba 100644 --- a/tests/compilers/test_compiler.py +++ b/tests/compilers/test_compiler.py @@ -42,7 +42,7 @@ class CompilerTest(unittest.TestCase): self.assert_(callable(compiler.builds("foo_bar"))) self.assert_(callable(compiler.builds("-"))) self.assertRaisesRegexp(TypeError, - "\*post\* translated strings", + r"\*post\* translated strings", compiler.builds, "foobar-with-dash-") diff --git a/tests/lex/test_lex.py b/tests/lex/test_lex.py index feba9c3..cc9e7cc 100644 --- a/tests/lex/test_lex.py +++ b/tests/lex/test_lex.py @@ -264,7 +264,7 @@ def test_escapes(): entry = tokenize("(foo \"foo\\n\")")[0] assert entry[1] == "foo\n" - entry = tokenize("(foo \"foo\s\")")[0] + entry = tokenize("(foo \"foo\\s\")")[0] assert entry[1] == "foo\\s"