##// END OF EJS Templates
Fix logic for longest_substring when only one input....
Fernando Perez -
Show More
@@ -140,6 +140,16 b' def test_dollar_formatter():'
140 nt.assert_equals(s, "$HOME")
140 nt.assert_equals(s, "$HOME")
141
141
142
142
143 def test_long_substr():
144 data = ['hi']
145 nt.assert_equals(text.long_substr(data), 'hi')
146
147
148 def test_long_substr2():
149 data = ['abc', 'abd', 'abf', 'ab']
150 nt.assert_equals(text.long_substr(data), 'ab')
151
152
143 def test_strip_email():
153 def test_strip_email():
144 src = """\
154 src = """\
145 >> >>> def f(x):
155 >> >>> def f(x):
@@ -152,3 +162,9 b' def test_strip_email():'
152 ...
162 ...
153 >>> zz = f(2.5)"""
163 >>> zz = f(2.5)"""
154 nt.assert_equals(text.strip_email_quotes(src), cln)
164 nt.assert_equals(text.strip_email_quotes(src), cln)
165
166
167 def test_strip_email2():
168 src = '> > > list()'
169 cln = 'list()'
170 nt.assert_equals(text.strip_email_quotes(src), cln)
@@ -553,6 +553,8 b' 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:
557 substr = data[0]
556 return substr
558 return substr
557
559
558
560
General Comments 0
You need to be logged in to leave comments. Login now