ยปCore Development>Code coverage>Lib/test/test_importlib/abc.py

Python code coverage for Lib/test/test_importlib/abc.py

#countcontent
1n/aimport abc
2n/a
3n/a
4n/aclass FinderTests(metaclass=abc.ABCMeta):
5n/a
6n/a """Basic tests for a finder to pass."""
7n/a
8n/a @abc.abstractmethod
9n/a def test_module(self):
10n/a # Test importing a top-level module.
11n/a pass
12n/a
13n/a @abc.abstractmethod
14n/a def test_package(self):
15n/a # Test importing a package.
16n/a pass
17n/a
18n/a @abc.abstractmethod
19n/a def test_module_in_package(self):
20n/a # Test importing a module contained within a package.
21n/a # A value for 'path' should be used if for a meta_path finder.
22n/a pass
23n/a
24n/a @abc.abstractmethod
25n/a def test_package_in_package(self):
26n/a # Test importing a subpackage.
27n/a # A value for 'path' should be used if for a meta_path finder.
28n/a pass
29n/a
30n/a @abc.abstractmethod
31n/a def test_package_over_module(self):
32n/a # Test that packages are chosen over modules.
33n/a pass
34n/a
35n/a @abc.abstractmethod
36n/a def test_failure(self):
37n/a # Test trying to find a module that cannot be handled.
38n/a pass
39n/a
40n/a
41n/aclass LoaderTests(metaclass=abc.ABCMeta):
42n/a
43n/a @abc.abstractmethod
44n/a def test_module(self):
45n/a """A module should load without issue.
46n/a
47n/a After the loader returns the module should be in sys.modules.
48n/a
49n/a Attributes to verify:
50n/a
51n/a * __file__
52n/a * __loader__
53n/a * __name__
54n/a * No __path__
55n/a
56n/a """
57n/a pass
58n/a
59n/a @abc.abstractmethod
60n/a def test_package(self):
61n/a """Loading a package should work.
62n/a
63n/a After the loader returns the module should be in sys.modules.
64n/a
65n/a Attributes to verify:
66n/a
67n/a * __name__
68n/a * __file__
69n/a * __package__
70n/a * __path__
71n/a * __loader__
72n/a
73n/a """
74n/a pass
75n/a
76n/a @abc.abstractmethod
77n/a def test_lacking_parent(self):
78n/a """A loader should not be dependent on it's parent package being
79n/a imported."""
80n/a pass
81n/a
82n/a @abc.abstractmethod
83n/a def test_state_after_failure(self):
84n/a """If a module is already in sys.modules and a reload fails
85n/a (e.g. a SyntaxError), the module should be in the state it was before
86n/a the reload began."""
87n/a pass
88n/a
89n/a @abc.abstractmethod
90n/a def test_unloadable(self):
91n/a """Test ImportError is raised when the loader is asked to load a module
92n/a it can't."""
93n/a pass