diff --git a/IPython/utils/tests/test_text.py b/IPython/utils/tests/test_text.py index a54a6d7..8822262 100644 --- a/IPython/utils/tests/test_text.py +++ b/IPython/utils/tests/test_text.py @@ -140,6 +140,16 @@ def test_dollar_formatter(): nt.assert_equals(s, "$HOME") +def test_long_substr(): + data = ['hi'] + nt.assert_equals(text.long_substr(data), 'hi') + + +def test_long_substr2(): + data = ['abc', 'abd', 'abf', 'ab'] + nt.assert_equals(text.long_substr(data), 'ab') + + def test_strip_email(): src = """\ >> >>> def f(x): @@ -152,3 +162,9 @@ def test_strip_email(): ... >>> zz = f(2.5)""" nt.assert_equals(text.strip_email_quotes(src), cln) + + +def test_strip_email2(): + src = '> > > list()' + cln = 'list()' + nt.assert_equals(text.strip_email_quotes(src), cln) diff --git a/IPython/utils/text.py b/IPython/utils/text.py index d16ea60..2646745 100644 --- a/IPython/utils/text.py +++ b/IPython/utils/text.py @@ -553,6 +553,8 @@ def long_substr(data): for j in range(len(data[0])-i+1): if j > len(substr) and all(data[0][i:i+j] in x for x in data): substr = data[0][i:i+j] + else: + substr = data[0] return substr