@@ -407,101 +407,6 @@ def test_reload_legacy(self):
407407 machinery = machinery )
408408
409409
410- class ModuleReprTests :
411-
412- @property
413- def bootstrap (self ):
414- return self .init ._bootstrap
415-
416- def setUp (self ):
417- self .module = type (os )('spam' )
418- self .spec = self .machinery .ModuleSpec ('spam' , TestLoader ())
419-
420- def test_module___loader___module_repr (self ):
421- class Loader :
422- def module_repr (self , module ):
423- return '<delicious {}>' .format (module .__name__ )
424- self .module .__loader__ = Loader ()
425- modrepr = self .bootstrap ._module_repr (self .module )
426-
427- self .assertEqual (modrepr , '<delicious spam>' )
428-
429- def test_module___loader___module_repr_bad (self ):
430- class Loader (TestLoader ):
431- def module_repr (self , module ):
432- raise Exception
433- self .module .__loader__ = Loader ()
434- modrepr = self .bootstrap ._module_repr (self .module )
435-
436- self .assertEqual (modrepr ,
437- '<module {!r} (<TestLoader object>)>' .format ('spam' ))
438-
439- def test_module___spec__ (self ):
440- origin = 'in a hole, in the ground'
441- self .spec .origin = origin
442- self .module .__spec__ = self .spec
443- modrepr = self .bootstrap ._module_repr (self .module )
444-
445- self .assertEqual (modrepr , '<module {!r} ({})>' .format ('spam' , origin ))
446-
447- def test_module___spec___location (self ):
448- location = 'in_a_galaxy_far_far_away.py'
449- self .spec .origin = location
450- self .spec ._set_fileattr = True
451- self .module .__spec__ = self .spec
452- modrepr = self .bootstrap ._module_repr (self .module )
453-
454- self .assertEqual (modrepr ,
455- '<module {!r} from {!r}>' .format ('spam' , location ))
456-
457- def test_module___spec___no_origin (self ):
458- self .spec .loader = TestLoader ()
459- self .module .__spec__ = self .spec
460- modrepr = self .bootstrap ._module_repr (self .module )
461-
462- self .assertEqual (modrepr ,
463- '<module {!r} (<TestLoader object>)>' .format ('spam' ))
464-
465- def test_module___spec___no_origin_no_loader (self ):
466- self .spec .loader = None
467- self .module .__spec__ = self .spec
468- modrepr = self .bootstrap ._module_repr (self .module )
469-
470- self .assertEqual (modrepr , '<module {!r}>' .format ('spam' ))
471-
472- def test_module_no_name (self ):
473- del self .module .__name__
474- modrepr = self .bootstrap ._module_repr (self .module )
475-
476- self .assertEqual (modrepr , '<module {!r}>' .format ('?' ))
477-
478- def test_module_with_file (self ):
479- filename = 'e/i/e/i/o/spam.py'
480- self .module .__file__ = filename
481- modrepr = self .bootstrap ._module_repr (self .module )
482-
483- self .assertEqual (modrepr ,
484- '<module {!r} from {!r}>' .format ('spam' , filename ))
485-
486- def test_module_no_file (self ):
487- self .module .__loader__ = TestLoader ()
488- modrepr = self .bootstrap ._module_repr (self .module )
489-
490- self .assertEqual (modrepr ,
491- '<module {!r} (<TestLoader object>)>' .format ('spam' ))
492-
493- def test_module_no_file_no_loader (self ):
494- modrepr = self .bootstrap ._module_repr (self .module )
495-
496- self .assertEqual (modrepr , '<module {!r}>' .format ('spam' ))
497-
498-
499- (Frozen_ModuleReprTests ,
500- Source_ModuleReprTests
501- ) = test_util .test_both (ModuleReprTests , init = init , util = util ,
502- machinery = machinery )
503-
504-
505410class FactoryTests :
506411
507412 def setUp (self ):
0 commit comments