@@ -328,20 +328,18 @@ def test_no_ascii_back_completion(self):
328328 name , matches = ip .complete ("\\ " + letter )
329329 self .assertEqual (matches , [])
330330
331- class CompletionSplitterTestCase (unittest .TestCase ):
332- def setUp (self ):
333- self .sp = completer .CompletionSplitter ()
334-
335- def test_delim_setting (self ):
336- self .sp .delims = " "
337- self .assertEqual (self .sp .delims , " " )
338- self .assertEqual (self .sp ._delim_expr , r"[\ ]" )
339-
340- def test_spaces (self ):
341- """Test with only spaces as split chars."""
342- self .sp .delims = " "
343- t = [("foo" , "" , "foo" ), ("run foo" , "" , "foo" ), ("run foo" , "bar" , "foo" )]
344- check_line_split (self .sp , t )
331+ def test_delim_setting (self ):
332+ sp = completer .CompletionSplitter ()
333+ sp .delims = " "
334+ self .assertEqual (sp .delims , " " )
335+ self .assertEqual (sp ._delim_expr , r"[\ ]" )
336+
337+ def test_spaces (self ):
338+ """Test with only spaces as split chars."""
339+ sp = completer .CompletionSplitter ()
340+ sp .delims = " "
341+ t = [("foo" , "" , "foo" ), ("run foo" , "" , "foo" ), ("run foo" , "bar" , "foo" )]
342+ check_line_split (sp , t )
345343
346344 def test_has_open_quotes1 (self ):
347345 for s in ["'" , "'''" , "'hi' '" ]:
@@ -462,26 +460,26 @@ def _test_complete(reason, s, comp, start=None, end=None):
462460 ip .Completer .use_jedi = True
463461 completions = set (ip .Completer .completions (s , l ))
464462 ip .Completer .use_jedi = False
465- assert_in ( Completion (start , end , comp ), completions , reason )
463+ assert Completion (start , end , comp ) in completions , reason
466464
467465 def _test_not_complete (reason , s , comp ):
468466 l = len (s )
469467 with provisionalcompleter ():
470468 ip .Completer .use_jedi = True
471469 completions = set (ip .Completer .completions (s , l ))
472470 ip .Completer .use_jedi = False
473- assert_not_in ( Completion (l , l , comp ), completions , reason )
471+ assert Completion (l , l , comp ) not in completions , reason
474472
475473 import jedi
476474
477475 jedi_version = tuple (int (i ) for i in jedi .__version__ .split ("." )[:3 ])
478476 if jedi_version > (0 , 10 ):
479- yield _test_complete , "jedi >0.9 should complete and not crash" , "a=1;a." , "real"
480- yield _test_complete , "can infer first argument" , 'a=(1,"foo");a[0].' , "real"
481- yield _test_complete , "can infer second argument" , 'a=(1,"foo");a[1].' , "capitalize"
482- yield _test_complete , "cover duplicate completions" , "im" , "import" , 0 , 2
477+ _test_complete ( "jedi >0.9 should complete and not crash" , "a=1;a." , "real" )
478+ _test_complete ( "can infer first argument" , 'a=(1,"foo");a[0].' , "real" )
479+ _test_complete ( "can infer second argument" , 'a=(1,"foo");a[1].' , "capitalize" )
480+ _test_complete ( "cover duplicate completions" , "im" , "import" , 0 , 2 )
483481
484- yield _test_not_complete , "does not mix types" , 'a=(1,"foo");a[0].' , "capitalize"
482+ _test_not_complete ( "does not mix types" , 'a=(1,"foo");a[0].' , "capitalize" )
485483
486484 def test_completion_have_signature (self ):
487485 """
@@ -548,15 +546,27 @@ def _(line, cursor_pos, expect, message, completion):
548546 self .assertIn (completion , completions )
549547
550548 with provisionalcompleter ():
551- yield _ , "a[0]." , 5 , "a[0].real" , "Should have completed on a[0].: %s" , Completion (
552- 5 , 5 , "real"
549+ _ (
550+ "a[0]." ,
551+ 5 ,
552+ "a[0].real" ,
553+ "Should have completed on a[0].: %s" ,
554+ Completion (5 , 5 , "real" ),
553555 )
554- yield _ , "a[0].r" , 6 , "a[0].real" , "Should have completed on a[0].r: %s" , Completion (
555- 5 , 6 , "real"
556+ _ (
557+ "a[0].r" ,
558+ 6 ,
559+ "a[0].real" ,
560+ "Should have completed on a[0].r: %s" ,
561+ Completion (5 , 6 , "real" ),
556562 )
557563
558- yield _ , "a[0].from_" , 10 , "a[0].from_bytes" , "Should have completed on a[0].from_: %s" , Completion (
559- 5 , 10 , "from_bytes"
564+ _ (
565+ "a[0].from_" ,
566+ 10 ,
567+ "a[0].from_bytes" ,
568+ "Should have completed on a[0].from_: %s" ,
569+ Completion (5 , 10 , "from_bytes" ),
560570 )
561571
562572 def test_omit__names (self ):
0 commit comments