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.
This commit is contained in:
Jakub Wilk 2016-12-30 11:20:26 +01:00 committed by Berker Peksag
parent 99b0bd0424
commit 7aaf5f5330
3 changed files with 3 additions and 3 deletions

View File

@ -144,7 +144,7 @@ def koan_macro():
@macro("ideas") @macro("ideas")
def ideas_macro(): def ideas_macro():
return HyExpression([HySymbol('print'), return HyExpression([HySymbol('print'),
HyString(""" HyString(r"""
=> (import [sh [figlet]]) => (import [sh [figlet]])
=> (figlet "Hi, Hy!") => (figlet "Hi, Hy!")

View File

@ -42,7 +42,7 @@ class CompilerTest(unittest.TestCase):
self.assert_(callable(compiler.builds("foo_bar"))) self.assert_(callable(compiler.builds("foo_bar")))
self.assert_(callable(compiler.builds("-"))) self.assert_(callable(compiler.builds("-")))
self.assertRaisesRegexp(TypeError, self.assertRaisesRegexp(TypeError,
"\*post\* translated strings", r"\*post\* translated strings",
compiler.builds, "foobar-with-dash-") compiler.builds, "foobar-with-dash-")

View File

@ -264,7 +264,7 @@ def test_escapes():
entry = tokenize("(foo \"foo\\n\")")[0] entry = tokenize("(foo \"foo\\n\")")[0]
assert entry[1] == "foo\n" assert entry[1] == "foo\n"
entry = tokenize("(foo \"foo\s\")")[0] entry = tokenize("(foo \"foo\\s\")")[0]
assert entry[1] == "foo\\s" assert entry[1] == "foo\\s"