summaryrefslogtreecommitdiffstats
path: root/Lib/importlib/test/test_abc.py
blob: c5a59085ea0fcd6d4035c95a89213c4b46d31705 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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.assertTrue(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()