Merge pull request #1463 from brawer/regex-escape

Fix “DeprecationWarning: invalid escape sequence” in Python 3.7
This commit is contained in:
Cosimo Lupo 2019-01-22 16:19:06 +00:00 committed by GitHub
commit 660b20feca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 7 deletions

View File

@ -122,13 +122,13 @@ class TimerTest(object):
test1()
assert re.match(
"Took [0-9]\.[0-9]{3}s to run 'test1'",
r"Took [0-9]\.[0-9]{3}s to run 'test1'",
logger.handlers[0].stream.getvalue())
test2()
assert re.search(
"Took [0-9]\.[0-9]{3}s to run test 2",
r"Took [0-9]\.[0-9]{3}s to run test 2",
logger.handlers[0].stream.getvalue())

View File

@ -765,7 +765,7 @@ class Base128Test(unittest.TestCase):
self.assertRaisesRegex(
ttLib.TTLibError,
"UIntBase128 value exceeds 2\*\*32-1",
r"UIntBase128 value exceeds 2\*\*32-1",
unpackBase128, b'\x90\x80\x80\x80\x00')
self.assertRaisesRegex(
@ -783,11 +783,11 @@ class Base128Test(unittest.TestCase):
self.assertEqual(packBase128(2**32-1), b'\x8f\xff\xff\xff\x7f')
self.assertRaisesRegex(
ttLib.TTLibError,
"UIntBase128 format requires 0 <= integer <= 2\*\*32-1",
r"UIntBase128 format requires 0 <= integer <= 2\*\*32-1",
packBase128, 2**32+1)
self.assertRaisesRegex(
ttLib.TTLibError,
"UIntBase128 format requires 0 <= integer <= 2\*\*32-1",
r"UIntBase128 format requires 0 <= integer <= 2\*\*32-1",
packBase128, -1)

View File

@ -450,10 +450,10 @@ class ParserTest(unittest.TestCase):
def test_lookup_name_starts_with_letter(self):
with self.assertRaisesRegex(
VoltLibError,
'Lookup name "\\\lookupname" must start with a letter'
r'Lookup name "\\lookupname" must start with a letter'
):
[lookup] = self.parse(
'DEF_LOOKUP "\lookupname"\n'
'DEF_LOOKUP "\\lookupname"\n'
'AS_SUBSTITUTION\n'
'SUB GLYPH "a"\n'
'WITH GLYPH "a.alt"\n'