##// END OF EJS Templates
Fix Crash: Eliding string with consecutive dots....
Matthias Bussonnier -
Show More
@@ -26,8 +26,12 b' def _elide(string, *, min_elide=30):'
26 26 If a string is long enough, and has at least 2 dots,
27 27 replace the middle part with ellipses.
28 28
29 For example:
29 If three consecutive dots, or two consecutive dots are encountered these are
30 replaced by the equivalents HORIZONTAL ELLIPSIS or TWO DOT LEADER unicode
31 equivalents
30 32 """
33 string = string.replace('...','\N{HORIZONTAL ELLIPSIS}')
34 string = string.replace('..','\N{TWO DOT LEADER}')
31 35 if len(string) < min_elide:
32 36 return string
33 37
@@ -10,6 +10,16 b' from IPython.core.inputtransformer import InputTransformer'
10 10 from IPython.testing import tools as tt
11 11 from IPython.utils.capture import capture_output
12 12
13 from IPython.terminal.ptutils import _elide
14 import nose.tools as nt
15
16 class TestElide(unittest.TestCase):
17
18 def test_elide(self):
19 _elide('concatenate((a1, a2, ...), axis') # do not raise
20 _elide('concatenate((a1, a2, ..), . axis') # do not raise
21 nt.assert_equal(_elide('aaaa.bbbb.ccccc.dddddd.eeeee.fffff.gggggg.hhhhhh'), 'aaaa.b…g.hhhhhh')
22
13 23 # Decorator for interaction loop tests -----------------------------------------
14 24
15 25 class mock_input_helper(object):
General Comments 0
You need to be logged in to leave comments. Login now