@@ -27,55 +27,55 @@ def test_changing_provider(self):
2727 self .assertIsInstance (ip .auto_suggest , NavigableAutoSuggestFromHistory )
2828
2929
30- class TestElide (unittest .TestCase ):
31- def test_elide (self ):
32- _elide ("concatenate((a1, a2, ...), axis" , "" ) # do not raise
33- _elide ("concatenate((a1, a2, ..), . axis" , "" ) # do not raise
34- self .assertEqual (
35- _elide ("aaaa.bbbb.ccccc.dddddd.eeeee.fffff.gggggg.hhhhhh" , "" ),
36- "aaaa.b…g.hhhhhh" ,
30+ def test_elide ():
31+ _elide ("concatenate((a1, a2, ...), axis" , "" , min_elide = 30 ) # do not raise
32+ _elide ("concatenate((a1, a2, ..), . axis" , "" , min_elide = 30 ) # do not raise
33+ assert (
34+ _elide ("aaaa.bbbb.ccccc.dddddd.eeeee.fffff.gggggg.hhhhhh" , "" , min_elide = 30 )
35+ == "aaaa.b…g.hhhhhh"
36+ )
37+
38+ test_string = os .sep .join (["" , 10 * "a" , 10 * "b" , 10 * "c" , "" ])
39+ expect_string = os .sep + "a" + "\N{HORIZONTAL ELLIPSIS} " + "b" + os .sep + 10 * "c"
40+ assert _elide (test_string , "" , min_elide = 30 ) == expect_string
41+
42+
43+ def test_elide_typed_normal ():
44+ assert (
45+ _elide (
46+ "the quick brown fox jumped over the lazy dog" ,
47+ "the quick brown fox" ,
48+ min_elide = 10 ,
3749 )
50+ == "the…fox jumped over the lazy dog"
51+ )
3852
39- test_string = os .sep .join (["" , 10 * "a" , 10 * "b" , 10 * "c" , "" ])
40- expect_string = (
41- os .sep + "a" + "\N{HORIZONTAL ELLIPSIS} " + "b" + os .sep + 10 * "c"
42- )
43- self .assertEqual (_elide (test_string , "" ), expect_string )
4453
45- def test_elide_typed_normal ( self ):
46- self . assertEqual (
47- _elide (
48- "the quick brown fox jumped over the lazy dog" ,
49- "the quick brown fox" ,
50- min_elide = 10 ,
51- ),
52- "the… fox jumped over the lazy dog",
53- )
54+ def test_elide_typed_short_match ( ):
55+ """
56+ if the match is too short we don't elide.
57+ avoid the "the... the"
58+ """
59+ assert (
60+ _elide ( "the quick brown fox jumped over the lazy dog" , "the" , min_elide = 10 )
61+ == "the quick brown fox jumped over the lazy dog"
62+ )
5463
55- def test_elide_typed_short_match (self ):
56- """
57- if the match is too short we don't elide.
58- avoid the "the...the"
59- """
60- self .assertEqual (
61- _elide ("the quick brown fox jumped over the lazy dog" , "the" , min_elide = 10 ),
62- "the quick brown fox jumped over the lazy dog" ,
63- )
6464
65- def test_elide_typed_no_match (self ):
66- """
67- if the match is too short we don't elide.
68- avoid the "the...the"
69- """
70- # here we typed red instead of brown
71- self .assertEqual (
72- _elide (
73- "the quick brown fox jumped over the lazy dog" ,
74- "the quick red fox" ,
75- min_elide = 10 ,
76- ),
65+ def test_elide_typed_no_match ():
66+ """
67+ if the match is too short we don't elide.
68+ avoid the "the...the"
69+ """
70+ # here we typed red instead of brown
71+ assert (
72+ _elide (
7773 "the quick brown fox jumped over the lazy dog" ,
74+ "the quick red fox" ,
75+ min_elide = 10 ,
7876 )
77+ == "the quick brown fox jumped over the lazy dog"
78+ )
7979
8080
8181class TestContextAwareCompletion (unittest .TestCase ):
0 commit comments