summaryrefslogtreecommitdiff
path: root/numpy/testing/utils.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2015-11-14 10:43:45 -0700
committerCharles Harris <charlesr.harris@gmail.com>2015-11-14 10:43:45 -0700
commit8ae543cb13769a0afa6e176898824db7fd992d27 (patch)
tree252fdf346b3cd5c211a2209e3176cb515afb010f /numpy/testing/utils.py
parentf83d68bdac7bf0843f1601da25ac51f97983b1ef (diff)
parenteadc135a5f2ab577748188770af66feafe87859d (diff)
downloadnumpy-8ae543cb13769a0afa6e176898824db7fd992d27.tar.gz
Merge pull request #6686 from pv/assert-fix
BUG: testing: fix a bug in assert_string_equal
Diffstat (limited to 'numpy/testing/utils.py')
-rw-r--r--numpy/testing/utils.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/numpy/testing/utils.py b/numpy/testing/utils.py
index 099b75bdf..8a282ff3c 100644
--- a/numpy/testing/utils.py
+++ b/numpy/testing/utils.py
@@ -1018,11 +1018,12 @@ def assert_string_equal(actual, desired):
if not d2.startswith('+ '):
raise AssertionError(repr(d2))
l.append(d2)
- d3 = diff.pop(0)
- if d3.startswith('? '):
- l.append(d3)
- else:
- diff.insert(0, d3)
+ if diff:
+ d3 = diff.pop(0)
+ if d3.startswith('? '):
+ l.append(d3)
+ else:
+ diff.insert(0, d3)
if re.match(r'\A'+d2[2:]+r'\Z', d1[2:]):
continue
diff_list.extend(l)