mirror of
https://github.com/python/cpython.git
synced 2024-11-24 08:52:25 +01:00
2a922ed6ad
(mostly stuff specified by PEP 302). There are two ABCs, PyLoader and PyPycLoader, which help with implementing source and source/bytecode loaders by implementing load_module in terms of other methods. This removes a lot of gritty details loaders typically have to worry about.
32 lines
810 B
Python
32 lines
810 B
Python
from importlib import abc
|
|
from importlib import machinery
|
|
import unittest
|
|
|
|
|
|
class SubclassTests(unittest.TestCase):
|
|
|
|
"""Test that the various classes in importlib are subclasses of the
|
|
expected ABCS."""
|
|
|
|
def verify(self, ABC, *classes):
|
|
"""Verify the classes are subclasses of the ABC."""
|
|
for cls in classes:
|
|
self.assert_(issubclass(cls, ABC))
|
|
|
|
def test_Finder(self):
|
|
self.verify(abc.Finder, machinery.BuiltinImporter,
|
|
machinery.FrozenImporter, machinery.PathFinder)
|
|
|
|
def test_Loader(self):
|
|
self.verify(abc.Loader, machinery.BuiltinImporter,
|
|
machinery.FrozenImporter)
|
|
|
|
|
|
def test_main():
|
|
from test.support import run_unittest
|
|
run_unittest(SubclassTests)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
test_main()
|