@@ -364,7 +364,9 @@ def test_push(self):
364364 # COMPLETE TESTS
365365 # 1. Global tests
366366 def test_simple_global_complete (self ):
367- self .repl = FakeRepl ({"autocomplete_mode" : autocomplete .SIMPLE })
367+ self .repl = FakeRepl (
368+ {"autocomplete_mode" : autocomplete .AutocompleteModes .SIMPLE }
369+ )
368370 self .set_input_line ("d" )
369371
370372 self .assertTrue (self .repl .complete ())
@@ -375,7 +377,9 @@ def test_simple_global_complete(self):
375377 )
376378
377379 def test_substring_global_complete (self ):
378- self .repl = FakeRepl ({"autocomplete_mode" : autocomplete .SUBSTRING })
380+ self .repl = FakeRepl (
381+ {"autocomplete_mode" : autocomplete .AutocompleteModes .SUBSTRING }
382+ )
379383 self .set_input_line ("time" )
380384
381385 self .assertTrue (self .repl .complete ())
@@ -385,7 +389,9 @@ def test_substring_global_complete(self):
385389 )
386390
387391 def test_fuzzy_global_complete (self ):
388- self .repl = FakeRepl ({"autocomplete_mode" : autocomplete .FUZZY })
392+ self .repl = FakeRepl (
393+ {"autocomplete_mode" : autocomplete .AutocompleteModes .FUZZY }
394+ )
389395 self .set_input_line ("doc" )
390396
391397 self .assertTrue (self .repl .complete ())
@@ -397,7 +403,9 @@ def test_fuzzy_global_complete(self):
397403
398404 # 2. Attribute tests
399405 def test_simple_attribute_complete (self ):
400- self .repl = FakeRepl ({"autocomplete_mode" : autocomplete .SIMPLE })
406+ self .repl = FakeRepl (
407+ {"autocomplete_mode" : autocomplete .AutocompleteModes .SIMPLE }
408+ )
401409 self .set_input_line ("Foo.b" )
402410
403411 code = "class Foo():\n \t def bar(self):\n \t \t pass\n "
@@ -409,7 +417,9 @@ def test_simple_attribute_complete(self):
409417 self .assertEqual (self .repl .matches_iter .matches , ["Foo.bar" ])
410418
411419 def test_substring_attribute_complete (self ):
412- self .repl = FakeRepl ({"autocomplete_mode" : autocomplete .SUBSTRING })
420+ self .repl = FakeRepl (
421+ {"autocomplete_mode" : autocomplete .AutocompleteModes .SUBSTRING }
422+ )
413423 self .set_input_line ("Foo.az" )
414424
415425 code = "class Foo():\n \t def baz(self):\n \t \t pass\n "
@@ -421,7 +431,9 @@ def test_substring_attribute_complete(self):
421431 self .assertEqual (self .repl .matches_iter .matches , ["Foo.baz" ])
422432
423433 def test_fuzzy_attribute_complete (self ):
424- self .repl = FakeRepl ({"autocomplete_mode" : autocomplete .FUZZY })
434+ self .repl = FakeRepl (
435+ {"autocomplete_mode" : autocomplete .AutocompleteModes .FUZZY }
436+ )
425437 self .set_input_line ("Foo.br" )
426438
427439 code = "class Foo():\n \t def bar(self):\n \t \t pass\n "
@@ -434,7 +446,9 @@ def test_fuzzy_attribute_complete(self):
434446
435447 # 3. Edge cases
436448 def test_updating_namespace_complete (self ):
437- self .repl = FakeRepl ({"autocomplete_mode" : autocomplete .SIMPLE })
449+ self .repl = FakeRepl (
450+ {"autocomplete_mode" : autocomplete .AutocompleteModes .SIMPLE }
451+ )
438452 self .set_input_line ("foo" )
439453 self .repl .push ("foobar = 2" )
440454
@@ -443,15 +457,19 @@ def test_updating_namespace_complete(self):
443457 self .assertEqual (self .repl .matches_iter .matches , ["foobar" ])
444458
445459 def test_file_should_not_appear_in_complete (self ):
446- self .repl = FakeRepl ({"autocomplete_mode" : autocomplete .SIMPLE })
460+ self .repl = FakeRepl (
461+ {"autocomplete_mode" : autocomplete .AutocompleteModes .SIMPLE }
462+ )
447463 self .set_input_line ("_" )
448464 self .assertTrue (self .repl .complete ())
449465 self .assertTrue (hasattr (self .repl .matches_iter , "matches" ))
450466 self .assertNotIn ("__file__" , self .repl .matches_iter .matches )
451467
452468 # 4. Parameter names
453469 def test_paremeter_name_completion (self ):
454- self .repl = FakeRepl ({"autocomplete_mode" : autocomplete .SIMPLE })
470+ self .repl = FakeRepl (
471+ {"autocomplete_mode" : autocomplete .AutocompleteModes .SIMPLE }
472+ )
455473 self .set_input_line ("foo(ab" )
456474
457475 code = "def foo(abc=1, abd=2, xyz=3):\n \t pass\n "
@@ -515,7 +533,9 @@ def test_simple_tab_complete(self):
515533 @unittest .skip ("disabled while non-simple completion is disabled" )
516534 def test_substring_tab_complete (self ):
517535 self .repl .s = "bar"
518- self .repl .config .autocomplete_mode = autocomplete .FUZZY
536+ self .repl .config .autocomplete_mode = (
537+ autocomplete .AutocompleteModes .FUZZY
538+ )
519539 self .repl .tab ()
520540 self .assertEqual (self .repl .s , "foobar" )
521541 self .repl .tab ()
@@ -524,7 +544,9 @@ def test_substring_tab_complete(self):
524544 @unittest .skip ("disabled while non-simple completion is disabled" )
525545 def test_fuzzy_tab_complete (self ):
526546 self .repl .s = "br"
527- self .repl .config .autocomplete_mode = autocomplete .FUZZY
547+ self .repl .config .autocomplete_mode = (
548+ autocomplete .AutocompleteModes .FUZZY
549+ )
528550 self .repl .tab ()
529551 self .assertEqual (self .repl .s , "foobar" )
530552
@@ -561,7 +583,9 @@ def test_back_parameter(self):
561583 def test_fuzzy_attribute_tab_complete (self ):
562584 """Test fuzzy attribute with no text"""
563585 self .repl .s = "Foo."
564- self .repl .config .autocomplete_mode = autocomplete .FUZZY
586+ self .repl .config .autocomplete_mode = (
587+ autocomplete .AutocompleteModes .FUZZY
588+ )
565589
566590 self .repl .tab ()
567591 self .assertEqual (self .repl .s , "Foo.foobar" )
@@ -570,7 +594,9 @@ def test_fuzzy_attribute_tab_complete(self):
570594 def test_fuzzy_attribute_tab_complete2 (self ):
571595 """Test fuzzy attribute with some text"""
572596 self .repl .s = "Foo.br"
573- self .repl .config .autocomplete_mode = autocomplete .FUZZY
597+ self .repl .config .autocomplete_mode = (
598+ autocomplete .AutocompleteModes .FUZZY
599+ )
574600
575601 self .repl .tab ()
576602 self .assertEqual (self .repl .s , "Foo.foobar" )
@@ -588,7 +614,9 @@ def test_simple_expand(self):
588614
589615 @unittest .skip ("disabled while non-simple completion is disabled" )
590616 def test_substring_expand_forward (self ):
591- self .repl .config .autocomplete_mode = autocomplete .SUBSTRING
617+ self .repl .config .autocomplete_mode = (
618+ autocomplete .AutocompleteModes .SUBSTRING
619+ )
592620 self .repl .s = "ba"
593621 self .repl .tab ()
594622 self .assertEqual (self .repl .s , "bar" )
0 commit comments