Show More
@@ -42,6 +42,8 b' def _elide(string, *, min_elide=30):' | |||
|
42 | 42 | |
|
43 | 43 | object_parts = string.split('.') |
|
44 | 44 | file_parts = string.split(os.sep) |
|
45 | if file_parts[-1] == '': | |
|
46 | file_parts.pop() | |
|
45 | 47 | |
|
46 | 48 | if len(object_parts) > 3: |
|
47 | 49 | return '{}.{}\N{HORIZONTAL ELLIPSIS}{}.{}'.format(object_parts[0], object_parts[1][0], object_parts[-2][-1], object_parts[-1]) |
@@ -5,6 +5,7 b'' | |||
|
5 | 5 | |
|
6 | 6 | import sys |
|
7 | 7 | import unittest |
|
8 | import os | |
|
8 | 9 | |
|
9 | 10 | from IPython.core.inputtransformer import InputTransformer |
|
10 | 11 | from IPython.testing import tools as tt |
@@ -19,6 +20,10 b' class TestElide(unittest.TestCase):' | |||
|
19 | 20 | _elide('concatenate((a1, a2, ...), axis') # do not raise |
|
20 | 21 | _elide('concatenate((a1, a2, ..), . axis') # do not raise |
|
21 | 22 | nt.assert_equal(_elide('aaaa.bbbb.ccccc.dddddd.eeeee.fffff.gggggg.hhhhhh'), 'aaaa.b…g.hhhhhh') |
|
23 | ||
|
24 | test_string = os.sep.join(['', 10*'a', 10*'b', 10*'c', '']) | |
|
25 | expect_stirng = os.sep + 'a' + '\N{HORIZONTAL ELLIPSIS}' + 'b' + os.sep + 10*'c' | |
|
26 | nt.assert_equal(_elide(test_string), expect_stirng) | |
|
22 | 27 | |
|
23 | 28 | |
|
24 | 29 | class TestContextAwareCompletion(unittest.TestCase): |
General Comments 0
You need to be logged in to leave comments.
Login now