##// END OF EJS Templates
Backport PR #2261: Fix: longest_substr([]) -> ''...
MinRK -
Show More
@@ -149,6 +149,9 def test_long_substr2():
149 data = ['abc', 'abd', 'abf', 'ab']
149 data = ['abc', 'abd', 'abf', 'ab']
150 nt.assert_equals(text.long_substr(data), 'ab')
150 nt.assert_equals(text.long_substr(data), 'ab')
151
151
152 def test_long_substr_empty():
153 data = []
154 nt.assert_equals(text.long_substr(data), '')
152
155
153 def test_strip_email():
156 def test_strip_email():
154 src = """\
157 src = """\
@@ -553,7 +553,7 def long_substr(data):
553 for j in range(len(data[0])-i+1):
553 for j in range(len(data[0])-i+1):
554 if j > len(substr) and all(data[0][i:i+j] in x for x in data):
554 if j > len(substr) and all(data[0][i:i+j] in x for x in data):
555 substr = data[0][i:i+j]
555 substr = data[0][i:i+j]
556 else:
556 elif len(data) == 1:
557 substr = data[0]
557 substr = data[0]
558 return substr
558 return substr
559
559
General Comments 0
You need to be logged in to leave comments. Login now