File: python-mox3-python3.6-compat.patch

package info (click to toggle)
guix 1.4.0-9
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 161,500 kB
  • sloc: lisp: 861,023; cpp: 10,741; javascript: 9,632; sh: 8,913; makefile: 951; ansic: 558; python: 129; sql: 33; sed: 16
file content (43 lines) | stat: -rw-r--r-- 1,566 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Fix regex so that it works with Python 3.6.

See <https://docs.python.org/3/library/re.html#re.LOCALE>.

Copied from upstream bug report:
https://bugs.launchpad.net/python-mox3/+bug/1665266

From 05064cdb6ea7a16450c6beae2b6f7c6074212a69 Mon Sep 17 00:00:00 2001
From: Zac Medico <zmedico@gentoo.org>
Date: Thu, 16 Feb 2017 00:24:10 -0800
Subject: [PATCH] RegexTest: python3.6 compatibility

These fixes are backward-compatible with older python versions:

* raw strings fix invalid escape sequences
* flags=8 fixes ValueError: cannot use LOCALE flag with a str pattern
---
 mox3/tests/test_mox.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mox3/tests/test_mox.py b/mox3/tests/test_mox.py
index 15ac565..3a1af17 100644
--- a/mox3/tests/test_mox.py
+++ b/mox3/tests/test_mox.py
@@ -312,12 +312,12 @@ class RegexTest(testtools.TestCase):
     def testReprWithoutFlags(self):
         """repr should return the regular expression pattern."""
         self.assertTrue(
-            repr(mox.Regex(r"a\s+b")) == "<regular expression 'a\s+b'>")
+            repr(mox.Regex(r"a\s+b")) == r"<regular expression 'a\s+b'>")
 
     def testReprWithFlags(self):
         """repr should return the regular expression pattern and flags."""
-        self.assertTrue(repr(mox.Regex(r"a\s+b", flags=4)) ==
-                        "<regular expression 'a\s+b', flags=4>")
+        self.assertTrue(repr(mox.Regex(r"a\s+b", flags=8)) ==
+                        r"<regular expression 'a\s+b', flags=8>")
 
 
 class IsTest(testtools.TestCase):
-- 
2.10.2