From 011f8a20044a3982b2441cb53876e9689a3f6d0c Mon Sep 17 00:00:00 2001 From: Charles Harris Date: Mon, 8 Apr 2013 11:34:24 -0600 Subject: 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. --- numpy/testing/utils.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'numpy/testing/utils.py') 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() -- cgit v1.2.1