mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Implement PEP 451 (ModuleSpec).
This commit is contained in:
parent
9e6097ebe7
commit
b523f8433a
37 changed files with 6972 additions and 4387 deletions
|
@ -1,5 +1,4 @@
|
|||
import contextlib
|
||||
from importlib._bootstrap import NamespaceLoader
|
||||
import importlib.abc
|
||||
import importlib.machinery
|
||||
import os
|
||||
|
@ -290,24 +289,5 @@ class ModuleAndNamespacePackageInSameDir(NamespacePackageTest):
|
|||
self.assertEqual(a_test.attr, 'in module')
|
||||
|
||||
|
||||
class ABCTests(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.loader = NamespaceLoader('foo', ['pkg'],
|
||||
importlib.machinery.PathFinder)
|
||||
|
||||
def test_is_package(self):
|
||||
self.assertTrue(self.loader.is_package('foo'))
|
||||
|
||||
def test_get_code(self):
|
||||
self.assertTrue(isinstance(self.loader.get_code('foo'), types.CodeType))
|
||||
|
||||
def test_get_source(self):
|
||||
self.assertEqual(self.loader.get_source('foo'), '')
|
||||
|
||||
def test_abc_isinstance(self):
|
||||
self.assertTrue(isinstance(self.loader, importlib.abc.InspectLoader))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue