[pygobject] tests: fix invalid regex escaping



commit c2be3cbefbbacb52758b49338be61d093a896d09
Author: Christoph Reiter <creiter src gnome org>
Date:   Sun Apr 2 10:52:41 2017 +0200

    tests: fix invalid regex escaping
    
    Python 3.6 got stricter here and raises warnings/errors for invalid escape
    sequences.

 tests/helper.py  |    4 ++--
 tests/test_gi.py |   24 ++++++++++++------------
 2 files changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/tests/helper.py b/tests/helper.py
index 4ac3dfe..0068945 100644
--- a/tests/helper.py
+++ b/tests/helper.py
@@ -105,8 +105,8 @@ def capture_glib_deprecation_warnings():
     with warnings.catch_warnings(record=True) as warn:
         warnings.filterwarnings(
             'always', category=GLibWarning,
-            message=".+ is deprecated and shouldn't be used anymore\. "
-                    "It will be removed in a future version\.")
+            message=".+ is deprecated and shouldn't be used anymore\\. "
+                    "It will be removed in a future version\\.")
         yield warn
 
 
diff --git a/tests/test_gi.py b/tests/test_gi.py
index 16d0d53..57442a4 100644
--- a/tests/test_gi.py
+++ b/tests/test_gi.py
@@ -2143,23 +2143,23 @@ class TestStructure(unittest.TestCase):
     def test_repr(self):
         self.assertRegexpMatches(
             repr(GIMarshallingTests.PointerStruct()),
-            "<GIMarshallingTests.PointerStruct object at 0x[^\s]+ "
-            "\(void at 0x[^\s]+\)>")
+            r"<GIMarshallingTests.PointerStruct object at 0x[^\s]+ "
+            r"\(void at 0x[^\s]+\)>")
 
         self.assertRegexpMatches(
             repr(GIMarshallingTests.SimpleStruct()),
-            "<GIMarshallingTests.SimpleStruct object at 0x[^\s]+ "
-            "\(void at 0x[^\s]+\)>")
+            r"<GIMarshallingTests.SimpleStruct object at 0x[^\s]+ "
+            r"\(void at 0x[^\s]+\)>")
 
         self.assertRegexpMatches(
             repr(GIMarshallingTests.Union()),
-            "<GIMarshallingTests.Union object at 0x[^\s]+ "
-            "\(GIMarshallingTestsUnion at 0x[^\s]+\)>")
+            r"<GIMarshallingTests.Union object at 0x[^\s]+ "
+            r"\(GIMarshallingTestsUnion at 0x[^\s]+\)>")
 
         self.assertRegexpMatches(
             repr(GIMarshallingTests.BoxedStruct()),
-            "<GIMarshallingTests.BoxedStruct object at 0x[^\s]+ "
-            "\(GIMarshallingTestsBoxedStruct at 0x[^\s]+\)>")
+            r"<GIMarshallingTests.BoxedStruct object at 0x[^\s]+ "
+            r"\(GIMarshallingTestsBoxedStruct at 0x[^\s]+\)>")
 
 
 class TestGObject(unittest.TestCase):
@@ -2294,14 +2294,14 @@ class TestGObject(unittest.TestCase):
     def test_repr(self):
         self.assertRegexpMatches(
             repr(GIMarshallingTests.Object(int=42)),
-            "<GIMarshallingTests.Object object at 0x[^\s]+ "
-            "\(GIMarshallingTestsObject at 0x[^\s]+\)>")
+            r"<GIMarshallingTests.Object object at 0x[^\s]+ "
+            r"\(GIMarshallingTestsObject at 0x[^\s]+\)>")
 
     def test_nongir_repr(self):
         self.assertRegexpMatches(
             repr(Gio.File.new_for_path("")),
-            "<__gi__.GLocalFile object at 0x[^\s]+ "
-            "\(GLocalFile at 0x[^\s]+\)>")
+            r"<__gi__.GLocalFile object at 0x[^\s]+ "
+            r"\(GLocalFile at 0x[^\s]+\)>")
 
 # FIXME: Doesn't actually return the same object.
 #    def test_object_inout_same(self):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]