summaryrefslogtreecommitdiff
path: root/numpy/testing/utils.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2013-04-08 11:34:24 -0600
committerCharles Harris <charlesr.harris@gmail.com>2013-04-08 11:52:32 -0600
commit011f8a20044a3982b2441cb53876e9689a3f6d0c (patch)
treec84a165c4b3d10421744785ffe2803bc069b09ea /numpy/testing/utils.py
parent01aa27a436476d87c4d986a80225d23179eebb44 (diff)
downloadnumpy-011f8a20044a3982b2441cb53876e9689a3f6d0c.tar.gz
2to3: Apply `repr` fixer.
This replaces python backtics with repr(...). The backtics were mostly used to generate strings for printing with a string format and it is tempting to replace `'%s' % repr(x)` with `'%r' % x`. That would work except where `x` happened to be a tuple or a dictionary but, because it would be significant work to guarantee that and because there are not many places where backtics are used, the safe path is to let the repr replacements stand. Closes #3083.
Diffstat (limited to 'numpy/testing/utils.py')
-rw-r--r--numpy/testing/utils.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/numpy/testing/utils.py b/numpy/testing/utils.py
index 234311689..cf35802ae 100644
--- a/numpy/testing/utils.py
+++ b/numpy/testing/utils.py
@@ -919,9 +919,9 @@ def assert_string_equal(actual, desired):
import difflib
if not isinstance(actual, str) :
- raise AssertionError(`type(actual)`)
+ raise AssertionError(repr(type(actual)))
if not isinstance(desired, str):
- raise AssertionError(`type(desired)`)
+ raise AssertionError(repr(type(desired)))
if re.match(r'\A'+desired+r'\Z', actual, re.M): return
diff = list(difflib.Differ().compare(actual.splitlines(1), desired.splitlines(1)))
diff_list = []
@@ -936,7 +936,7 @@ def assert_string_equal(actual, desired):
l.append(d2)
d2 = diff.pop(0)
if not d2.startswith('+ ') :
- raise AssertionError(`d2`)
+ raise AssertionError(repr(d2))
l.append(d2)
d3 = diff.pop(0)
if d3.startswith('? '):
@@ -947,7 +947,7 @@ def assert_string_equal(actual, desired):
continue
diff_list.extend(l)
continue
- raise AssertionError(`d1`)
+ raise AssertionError(repr(d1))
if not diff_list:
return
msg = 'Differences in strings:\n%s' % (''.join(diff_list)).rstrip()