@@ -357,23 +357,36 @@ def find_spec(self, fullname, path, target=None):
357357
358358 return MetaPathSpecFinder ()
359359
360- def test_no_spec (self ):
360+ def test_find_module (self ):
361361 finder = self .finder (None )
362362 path = ['a' , 'b' , 'c' ]
363363 name = 'blah'
364364 with self .assertWarns (DeprecationWarning ):
365365 found = finder .find_module (name , path )
366366 self .assertIsNone (found )
367+
368+ def test_find_spec_with_explicit_target (self ):
369+ loader = object ()
370+ spec = self .util .spec_from_loader ('blah' , loader )
371+ finder = self .finder (spec )
372+ found = finder .find_spec ('blah' , 'blah' , None )
373+ self .assertEqual (found , spec )
374+
375+ def test_no_spec (self ):
376+ finder = self .finder (None )
377+ path = ['a' , 'b' , 'c' ]
378+ name = 'blah'
379+ found = finder .find_spec (name , path , None )
380+ self .assertIsNone (found )
367381 self .assertEqual (name , finder .called_for [0 ])
368382 self .assertEqual (path , finder .called_for [1 ])
369383
370384 def test_spec (self ):
371385 loader = object ()
372386 spec = self .util .spec_from_loader ('blah' , loader )
373387 finder = self .finder (spec )
374- with self .assertWarns (DeprecationWarning ):
375- found = finder .find_module ('blah' , None )
376- self .assertIs (found , spec .loader )
388+ found = finder .find_spec ('blah' , None )
389+ self .assertIs (found , spec )
377390
378391
379392(Frozen_MPFFindModuleTests ,
0 commit comments