From eadc135a5f2ab577748188770af66feafe87859d Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Sat, 14 Nov 2015 14:28:25 +0200 Subject: BUG: testing: fix a bug in assert_string_equal --- numpy/testing/utils.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'numpy/testing/utils.py') 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) -- cgit v1.2.1