Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(96477)

Delta Between Two Patch Sets: Lib/test/test_importlib/test_spec.py

Issue 18864: Implementation for PEP 451 (importlib.machinery.ModuleSpec)
Left Patch Set: Created 5 years, 10 months ago
Right Patch Set: Created 5 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « Lib/importlib/_bootstrap.py ('k') | Python/importlib.h » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 from . import util 1 from . import util
2 2
3 frozen_init, source_init = util.import_importlib('importlib') 3 frozen_init, source_init = util.import_importlib('importlib')
4 frozen_bootstrap = frozen_init._bootstrap 4 frozen_bootstrap = frozen_init._bootstrap
5 source_bootstrap = source_init._bootstrap 5 source_bootstrap = source_init._bootstrap
6 frozen_machinery, source_machinery = util.import_importlib('importlib.machinery' ) 6 frozen_machinery, source_machinery = util.import_importlib('importlib.machinery' )
7 frozen_util, source_util = util.import_importlib('importlib.util') 7 frozen_util, source_util = util.import_importlib('importlib.util')
8 8
9 import os.path 9 import os.path
10 from test.support import CleanImport 10 from test.support import CleanImport
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 spec = self.machinery.ModuleSpec(self.name, self.loader, 115 spec = self.machinery.ModuleSpec(self.name, self.loader,
116 is_package=True) 116 is_package=True)
117 117
118 self.assertEqual(spec.name, self.name) 118 self.assertEqual(spec.name, self.name)
119 self.assertEqual(spec.loader, self.loader) 119 self.assertEqual(spec.loader, self.loader)
120 self.assertIs(spec.origin, None) 120 self.assertIs(spec.origin, None)
121 self.assertIs(spec.loader_state, None) 121 self.assertIs(spec.loader_state, None)
122 self.assertEqual(spec.submodule_search_locations, []) 122 self.assertEqual(spec.submodule_search_locations, [])
123 self.assertIs(spec.cached, None) 123 self.assertIs(spec.cached, None)
124 self.assertFalse(spec.has_location) 124 self.assertFalse(spec.has_location)
125
126 def test_has_location_setter(self):
127 spec = self.machinery.ModuleSpec(self.name, self.loader,
128 origin='somewhere')
129 self.assertFalse(spec.has_location)
130 spec.has_location = True
131 self.assertTrue(spec.has_location)
125 132
126 def test_equality(self): 133 def test_equality(self):
127 other = type(sys.implementation)(name=self.name, 134 other = type(sys.implementation)(name=self.name,
128 loader=self.loader, 135 loader=self.loader,
129 origin=None, 136 origin=None,
130 submodule_search_locations=None, 137 submodule_search_locations=None,
131 has_location=False, 138 has_location=False,
132 cached=None, 139 cached=None,
133 ) 140 )
134 141
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 970
964 971
965 class Frozen_FactoryTests(FactoryTests, unittest.TestCase): 972 class Frozen_FactoryTests(FactoryTests, unittest.TestCase):
966 util = frozen_util 973 util = frozen_util
967 machinery = frozen_machinery 974 machinery = frozen_machinery
968 975
969 976
970 class Source_FactoryTests(FactoryTests, unittest.TestCase): 977 class Source_FactoryTests(FactoryTests, unittest.TestCase):
971 util = source_util 978 util = source_util
972 machinery = source_machinery 979 machinery = source_machinery
LEFTRIGHT

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+