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

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

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