@@ -28,15 +28,8 @@ def reset(self):
2828class FakeRepl (repl .Repl ):
2929 def __init__ (self , conf = {}):
3030 repl .Repl .__init__ (self , repl .Interpreter (), setup_config (conf ))
31- self .input_line = ""
32- self .current_word = ""
33- self .cpos = 0
34-
35- def current_line (self ):
36- return self .input_line
37-
38- def cw (self ):
39- return self .current_word
31+ self .current_line = ""
32+ self .cursor_offset = 0
4033
4134class FakeCliRepl (cli .CLIRepl , FakeRepl ):
4235 def __init__ (self ):
@@ -178,7 +171,8 @@ def setUp(self):
178171
179172 def setInputLine (self , line ):
180173 """Set current input line of the test REPL."""
181- self .repl .input_line = line
174+ self .repl .current_line = line
175+ self .repl .cursor_offset = len (line )
182176
183177 def test_func_name (self ):
184178 for (line , expected_name ) in [("spam(" , "spam" ),
@@ -260,10 +254,11 @@ def test_simple_global_complete(self):
260254 self .repl .current_word = "d"
261255
262256 self .assertTrue (self .repl .complete ())
263- self .assertTrue (hasattr (self .repl .completer ,'matches' ))
257+ self .assertTrue (hasattr (self .repl .matches_iter ,'matches' ))
264258 self .assertEqual (self .repl .completer .matches ,
265259 ['def' , 'del' , 'delattr(' , 'dict(' , 'dir(' , 'divmod(' ])
266260
261+ @skip ("disabled while non-simple completion is disabled" )
267262 def test_substring_global_complete (self ):
268263 self .repl = FakeRepl ({'autocomplete_mode' : autocomplete .SUBSTRING })
269264 self .repl .input_line = "time"
@@ -274,6 +269,7 @@ def test_substring_global_complete(self):
274269 self .assertEqual (self .repl .completer .matches ,
275270 ['RuntimeError(' , 'RuntimeWarning(' ])
276271
272+ @skip ("disabled while non-simple completion is disabled" )
277273 def test_fuzzy_global_complete (self ):
278274 self .repl = FakeRepl ({'autocomplete_mode' : autocomplete .FUZZY })
279275 self .repl .input_line = "doc"
@@ -295,10 +291,11 @@ def test_simple_attribute_complete(self):
295291 self .repl .push (line )
296292
297293 self .assertTrue (self .repl .complete ())
298- self .assertTrue (hasattr (self .repl .completer ,'matches' ))
299- self .assertEqual (self .repl .completer .matches ,
294+ self .assertTrue (hasattr (self .repl .matches_iter ,'matches' ))
295+ self .assertEqual (self .repl .matches_iter .matches ,
300296 ['Foo.bar' ])
301297
298+ @skip ("disabled while non-simple completion is disabled" )
302299 def test_substring_attribute_complete (self ):
303300 self .repl = FakeRepl ({'autocomplete_mode' : autocomplete .SUBSTRING })
304301 self .repl .input_line = "Foo.az"
@@ -313,6 +310,7 @@ def test_substring_attribute_complete(self):
313310 self .assertEqual (self .repl .completer .matches ,
314311 ['Foo.baz' ])
315312
313+ @skip ("disabled while non-simple completion is disabled" )
316314 def test_fuzzy_attribute_complete (self ):
317315 self .repl = FakeRepl ({'autocomplete_mode' : autocomplete .FUZZY })
318316 self .repl .input_line = "Foo.br"
@@ -335,17 +333,17 @@ def test_updating_namespace_complete(self):
335333 self .repl .push ("foobar = 2" )
336334
337335 self .assertTrue (self .repl .complete ())
338- self .assertTrue (hasattr (self .repl .completer ,'matches' ))
339- self .assertEqual (self .repl .completer .matches ,
336+ self .assertTrue (hasattr (self .repl .matches_iter ,'matches' ))
337+ self .assertEqual (self .repl .matches_iter .matches ,
340338 ['foobar' ])
341339
342340 def test_file_should_not_appear_in_complete (self ):
343341 self .repl = FakeRepl ({'autocomplete_mode' : autocomplete .SIMPLE })
344342 self .repl .input_line = "_"
345343 self .repl .current_word = "_"
346344 self .assertTrue (self .repl .complete ())
347- self .assertTrue (hasattr (self .repl .completer ,'matches' ))
348- self .assertTrue ('__file__' not in self .repl .completer .matches )
345+ self .assertTrue (hasattr (self .repl .matches_iter ,'matches' ))
346+ self .assertTrue ('__file__' not in self .repl .matches_iter .matches )
349347
350348
351349class TestCliRepl (unittest .TestCase ):
@@ -373,29 +371,6 @@ def test_addstr(self):
373371 self .repl .addstr ('buzz' )
374372 self .assertEqual (self .repl .s , "foobuzzbar" )
375373
376- def test_cw (self ):
377-
378- self .repl .cpos = 2
379- self .assertEqual (self .repl .cw (), None )
380- self .repl .cpos = 0
381-
382- self .repl .s = ''
383- self .assertEqual (self .repl .cw (), None )
384-
385- self .repl .s = "this.is.a.test\t "
386- self .assertEqual (self .repl .cw (), None )
387-
388- s = "this.is.a.test"
389- self .repl .s = s
390- self .assertEqual (self .repl .cw (), s )
391-
392- s = "\t \t this.is.a.test"
393- self .repl .s = s
394- self .assertEqual (self .repl .cw (), s .lstrip ())
395-
396- self .repl .s = "import datetime"
397- self .assertEqual (self .repl .cw (), 'datetime' )
398-
399374class TestCliReplTab (unittest .TestCase ):
400375
401376 def setUp (self ):
@@ -437,6 +412,7 @@ def test_simple_tab_complete(self):
437412 self .repl .tab ()
438413 self .assertEqual (self .repl .s , "foobar" )
439414
415+ @skip ("disabled while non-simple completion is disabled" )
440416 def test_substring_tab_complete (self ):
441417 self .repl .s = "bar"
442418 self .repl .config .autocomplete_mode = autocomplete .FUZZY
@@ -445,6 +421,7 @@ def test_substring_tab_complete(self):
445421 self .repl .tab ()
446422 self .assertEqual (self .repl .s , "foofoobar" )
447423
424+ @skip ("disabled while non-simple completion is disabled" )
448425 def test_fuzzy_tab_complete (self ):
449426 self .repl .s = "br"
450427 self .repl .config .autocomplete_mode = autocomplete .FUZZY
@@ -485,6 +462,7 @@ def test_current_word(self):
485462 self .assertEqual (self .repl .s , "import foofoobar" )
486463
487464 # Attribute Tests
465+ @skip ("disabled while non-simple completion is disabled" )
488466 def test_fuzzy_attribute_tab_complete (self ):
489467 """Test fuzzy attribute with no text"""
490468 self .repl .s = "Foo."
@@ -493,6 +471,7 @@ def test_fuzzy_attribute_tab_complete(self):
493471 self .repl .tab ()
494472 self .assertEqual (self .repl .s , "Foo.foobar" )
495473
474+ @skip ("disabled while non-simple completion is disabled" )
496475 def test_fuzzy_attribute_tab_complete2 (self ):
497476 """Test fuzzy attribute with some text"""
498477 self .repl .s = "Foo.br"
@@ -507,12 +486,14 @@ def test_simple_expand(self):
507486 self .repl .tab ()
508487 self .assertEqual (self .repl .s , "foo" )
509488
489+ @skip ("disabled while non-simple completion is disabled" )
510490 def test_substring_expand_forward (self ):
511491 self .repl .config .autocomplete_mode = autocomplete .SUBSTRING
512492 self .repl .s = "ba"
513493 self .repl .tab ()
514494 self .assertEqual (self .repl .s , "bar" )
515495
496+ @skip ("disabled while non-simple completion is disabled" )
516497 def test_fuzzy_expand (self ):
517498 pass
518499
0 commit comments