[Python-checkins] Make regular expressions in test_tasks.py raw strings. (GH-8759)

Benjamin Peterson webhook-mailer at python.org
Tue Aug 14 00:32:34 EDT 2018


https://github.com/python/cpython/commit/aa4e4a40db531f7095513a4b0aa6510f18162a07
commit: aa4e4a40db531f7095513a4b0aa6510f18162a07
branch: master
author: Benjamin Peterson <benjamin at python.org>
committer: GitHub <noreply at github.com>
date: 2018-08-13T21:32:30-07:00
summary:

Make regular expressions in test_tasks.py raw strings. (GH-8759)

Follow up to bpo-34270.

Fixes:
```
Lib/test/test_asyncio/test_tasks.py:330: DeprecationWarning: invalid escape sequence \d
  match1 = re.match("^<Task pending name='Task-(\d+)'", repr(t1))
Lib/test/test_asyncio/test_tasks.py:332: DeprecationWarning: invalid escape sequence \d
  match2 = re.match("^<Task pending name='Task-(\d+)'", repr(t2))
```

files:
M Lib/test/test_asyncio/test_tasks.py

diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py
index c9305936de55..40d1953532bc 100644
--- a/Lib/test/test_asyncio/test_tasks.py
+++ b/Lib/test/test_asyncio/test_tasks.py
@@ -327,9 +327,9 @@ def notmuch():
         t2 = self.new_task(self.loop, notmuch(), None)
         self.assertNotEqual(repr(t1), repr(t2))
 
-        match1 = re.match("^<Task pending name='Task-(\d+)'", repr(t1))
+        match1 = re.match(r"^<Task pending name='Task-(\d+)'", repr(t1))
         self.assertIsNotNone(match1)
-        match2 = re.match("^<Task pending name='Task-(\d+)'", repr(t2))
+        match2 = re.match(r"^<Task pending name='Task-(\d+)'", repr(t2))
         self.assertIsNotNone(match2)
 
         # Autogenerated task names should have monotonically increasing numbers



More information about the Python-checkins mailing list